home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / imgdllll / imgdll.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-16  |  111.0 KB  |  3,774 lines

  1. ////////////////////////////////////////////////////////////
  2. //
  3. //    ImgDLL - a Win32 Image File Processing DLL
  4. //
  5. //    Copyright 1997, 1989 Smaller Animals Software
  6. //
  7. //    Author 
  8. //        Chris Losinger, smallest@smalleranimals.com
  9. //        http://www.smalleranimals.com/index.htm
  10. //
  11. //        This DLL provides JPG, PCX, PNG, TIFF and BMP read and write 
  12. //    support.
  13. //        Also included are routines to do various image processing
  14. //    functions such as 24-bit to 8-bit color quantization and
  15. //    gray-scaling, resizing, sharpening and blurring, 
  16. //    DWORD-alignment utilities, image size querys, etc..
  17. //
  18. //        Note : GIF support has been removed as of 9/23/97. If you
  19. // absolutely need GIF support, I may be able to help you. Ask.
  20. //
  21. //        This DLL is freely distributable. The full-access key is not.
  22. //    If you have a full-access key without paying for it, you are
  23. //    using this without permission, and that is illegal. I hope you 
  24. //    feel bad.
  25. //    
  26. //
  27. //    Tech Credit:
  28. //
  29. //        Color quantization code modified from DL1Quant, by Dennis Lee 
  30. //            (denlee@ecf.utoronto.ca)
  31. //
  32. //        JPEG code from IJG v6a.
  33. //
  34. //        GIF code from "Programming for Graphics Files" by John Levine.
  35. //
  36. //        PCX code from Bob Johnson's PCXLib
  37. //
  38. //        PNG code from LibPng 1.0.0
  39. //
  40. //        All other code written by Smaller Animals Software, Chris Losinger.
  41. //
  42. //
  43. //    Usage notes :
  44. //
  45. //        0)    DLL must be initialized with ImgDLLInitDLL. the value passed to
  46. //    this function may be the key to unlock the full version of the DLL.
  47. //    Registered users will be given the real key. Everyone else is free to
  48. //    try any value they like.
  49. //
  50. //        1)    all strings are to be zero-terminated - some languages don't do this
  51. //    by default. 
  52. //
  53. //        2)    UINT is a 32-bit unsigned integer. this works as a "long" in VB. 
  54. //    VB's "Integer" is too small!!
  55. //
  56. //        3)    BOOL is a 32-bit unsigned integer. zero for FALSE, non-zero for TRUE.
  57. //
  58. //        4)    RGBQUAD is a structure defined as follows :
  59. //
  60. //        typedef struct tagRGBQUAD { 
  61. //            BYTE    rgbBlue; 
  62. //            BYTE    rgbGreen; 
  63. //            BYTE    rgbRed; 
  64. //            BYTE    rgbReserved;           // rarely used
  65. //        } RGBQUAD; 
  66. //
  67. //        5)    "int" is a 32-bit signed integer.
  68. //
  69. //        6)    HGLOBAL is a HANDLE to memory allocated by GlobalAlloc.
  70. //    If a routine returns a non-NULL HGLOBAL value, it is up to
  71. //    the caller to call GlobalFree to release this memory back
  72. //    to the system. See ImgDLLv3.rtf for more info.
  73. //
  74. //        7)  RGB means 24-bit (3 BYTEs per pixel)  Red,Green,Blue, one BYTE each.
  75. //    If you have an RGB buffer of an image that is 100 x 100 pixels, you
  76. //    MUST have a buffer of 100 x 3 x 100 BYTEs!! All calls that says RGB
  77. //    assume this arrangement. RGB is the same as "packed RGB".
  78. //    
  79. //        8)    double designates a 64-bit floating-point number.
  80. //
  81. //        9)    "colormapped 8-bit" means an image which is made up of 8-bit pixels
  82. //    each of which is an index into a palette of 24-bit RGB values. 
  83. //    a "colormapped 8-bit" buffer is not the same as a 24-bit (RGB) buffer.
  84. //
  85. ////////////////////////////////////////////////////////////
  86.  
  87. #ifndef IMGDLLH
  88. #define IMGDLLH
  89.  
  90. #define IMGEXP FAR PASCAL
  91.  
  92. ////////////////////////////////////////////////////////////
  93. // error codes
  94.  
  95. #define TRIALVERSION    -1        // LIB was not initialized with a registered key
  96.  
  97. #define IMGOK            0        // no err
  98. #define MEMERR            1        // out of mem
  99. #define FILEOPENERR        2        // error on file open
  100. #define FILEREADERR        3        // error on file read
  101. #define FILEWRITEERR    4        // error on file write
  102. #define BADPARAMERR        5        // bad user param
  103. #define INVALIDBMPERR    6        // bad BMP file
  104. #define BMPRLEERR        7        // we don't do compressed (RLE) BMP files
  105. #define INVALIDGIFERR    8        // bad GIF file
  106. #define INVALIDJPGERR    9        // bad JPG file
  107. #define IMGDCERR        10        // error with device context
  108. #define IMGDIBERR        11        // problem with a GetDIBits call
  109. #define NOGIFERR        12        // GIF support disabled
  110. #define IMGNORESOURCE    13        // resource not found
  111. #define CALLBACKCANCEL    14        // callback returned FALSE - operation aborted
  112. #define INVALIDPNGERR    15        // bad PNG file
  113. #define PNGCREATEERR    16        // internal PNG lib behavior - contact smaller animals s.w.
  114. #define IMGDLLINTERNAL    17        // misc unexpected behavior error - contact smaller animals s.w.
  115. #define IMGFONTERR        18        // trouble creating a font object
  116. #define INTTIFFERR        19        // misc internal TIFF error
  117. #define INVALIDTIFFERR    20        // invalid TIFF file
  118. #define TIFFLZWNOTSUPPORTED    21    // this will not read TIFF-LZW iamges
  119. #define INVALIDPCXERR    22        // invalid PCX image
  120. #define CREATEBMPERR        23        // a call to the fn CreateCompatibleBitmap failed
  121. #define IMGNOLINES        24        // end of an image while using single-line de/compression
  122. #define GETDIBERR            25        // error during a call to GetDIBits
  123.  
  124. #define IMGDLL_LOCK_KEY    0        // key to unlock DLL provided to registered
  125.                                 // users only. any other key will prevent the DLL
  126.                                 // from offering full functionality.
  127.  
  128. // channelMask values : e.g.
  129. //    BYTE mask = CHRED | CHGREEN;// use only red and green values in this operation
  130.  
  131. #define CHRED        1            // include RED channel if this is set in channelMask
  132. #define CHGREEN        2
  133. #define CHBLUE        4
  134.  
  135. #ifdef __cplusplus
  136. extern "C" {
  137. #endif
  138.  
  139. ////////////////////////////////////////////////////////////
  140. //
  141. //    void IMGEXP ImgDLLStringInitDLL(const char * initString)
  142. //
  143. //    Purpose :
  144. //        Perform DLL initialization / unlock. This is intended
  145. //    for VB people who cannot use 32-bit unsigned ints. You will
  146. //    need to generate a string representation of the numeric key.
  147. //
  148. //    e.g. if the key is 123456789, you will pass the 
  149. //    string "123456789" as the argument.
  150. //
  151. //    This must be a string of the decimal representation (not hex, octal or
  152. //    binary) of the key!!!!
  153. //
  154. //
  155. //    Param                Type            Use
  156. //    initString            const char *    can be used to unlock DLL 
  157. //                                        functionality. see value
  158. //                                        of LOCK_KEY in imgdll.h
  159. //                        
  160. //                                        users who have paid for the DLL
  161. //                                        will be given a value for LOCK_KEY
  162. //                                        that will allow them to use all
  163. //                                        of the DLLs functions without limits.
  164. //
  165. //    Note :
  166. //    This call should only be called once per session. All calls
  167. //    after the first will have no effect. That is, you can't put this
  168. //    in a loop and try new initVal values until you find the right one.
  169. //
  170. //    Besides unlocking the DLL, this performs other useful initialization
  171. //    functions.
  172. //
  173. //    Note :
  174. //
  175. //    Return
  176. //        none
  177. //
  178. ////////////////////////////////////////////////////////////
  179.  
  180. void IMGEXP ImgDLLStringInitDLL(const char * initString);
  181.  
  182. ////////////////////////////////////////////////////////////
  183. //
  184. //    void IMGEXP ImgDLLInitDLL(UINT initVal)
  185. //
  186. //    Purpose :
  187. //        Perform DLL initialization / unlock.
  188. //
  189. //    Param                Type            Use
  190. //    initVal                UINT            can be used to unlock DLL 
  191. //                                        functionality. see value
  192. //                                        of LOCK_KEY in imgdll.h
  193. //                        
  194. //                                        users who have paid for the DLL
  195. //                                        will be given a value for LOCK_KEY
  196. //                                        that will allow them to use all
  197. //                                        of the DLLs functions without limits.
  198. //
  199. //    Note :
  200. //    This call should only be called once per session. All calls
  201. //    after the first will have no effect. That is, you can't put this
  202. //    in a loop and try new initVal values until you find the right one.
  203. //
  204. //    Besides unlocking the DLL, this performs other useful initialization
  205. //    functions.
  206. //
  207. //    Note :
  208. //    A UINT is an "unsigned int". 32 bits. 4,294,967,296 possible values.
  209. //
  210. //    Return
  211. //        none
  212. //
  213. ////////////////////////////////////////////////////////////
  214.  
  215. void IMGEXP ImgDLLInitDLL(UINT initVal);
  216.  
  217. ////////////////////////////////////////////////////////////
  218. //
  219. //    BOOL IMGEXP ImgDLLGetVersion(char * versString,
  220. //                              int iLen)
  221. //
  222. //    Purpose :
  223. //        Get ImgDLL version string
  224. //
  225. //    Param                Type            Use
  226. //    versString        char *        caller-allocated buffer of chars
  227. //                                        this will receive the version string
  228. //
  229. //    iLen                int            length of buffer (including space for trailing 0)
  230. //
  231. //    for safety, versString should be at least 15 characters long
  232. //
  233. //    Return
  234. //        TRUE on success
  235. //
  236. ////////////////////////////////////////////////////////////
  237.  
  238. BOOL IMGEXP ImgDLLGetVersion(char * versString,
  239.                                         int iLen);
  240.  
  241. ////////////////////////////////////////////////////////////
  242. //
  243. //    int IMGEXP ImgDLLGetLastError()
  244. //
  245. //    Purpose :
  246. //        query the last error value
  247. //
  248. //    Param                Type            Use
  249. //    none
  250. //
  251. //    Return
  252. //        int value of error - see above for values and meaning
  253. //
  254. ////////////////////////////////////////////////////////////
  255.  
  256. int IMGEXP ImgDLLGetLastError();
  257.  
  258. ////////////////////////////////////////////////////////////
  259. //
  260. //    void IMGEXP ImgDLLSetJPGErrorMsgBox(BOOL enable)
  261. //
  262. //    Enable JPG error message boxes
  263. //
  264. //    Param                Type            Use
  265. //    enable                BOOL            TRUE, enable modal msg boxes, else 
  266. //                                        disable
  267. //
  268. //
  269. //    Return
  270. //        none
  271. //
  272. ////////////////////////////////////////////////////////////
  273.  
  274. void IMGEXP ImgDLLSetJPGErrorMsgBox(BOOL enable);
  275.  
  276. ////////////////////////////////////////////////////////////
  277. //
  278. //    void IMGEXP ImgDLLSetJPGDCT(UINT dct)
  279. //
  280. //    Switch the compression method : dct is one of :
  281. //
  282. //    0 - default (usually JDCT_ISLOW)
  283. //    1 - JDCT_ISLOW: slow but accurate integer algorithm
  284. //    2 - JDCT_IFAST: faster, less accurate integer method
  285. //    3 - JDCT_FLOAT: floating-point method
  286. //
  287. //    It is not necessary to use this function to be able save JPG files.
  288. //    This is only for people who need more speed or higher quality
  289. //    in their output.
  290. //
  291. //    All JPG files written will be written using this setting.
  292. //    
  293. //    Param        Type            Use
  294. //    dct            UINT            which level to set
  295. //
  296. //    Return
  297. //        none
  298. //
  299. ////////////////////////////////////////////////////////////
  300. void IMGEXP ImgDLLSetJPGDCT(UINT dct);
  301.  
  302. /////////////////////////////////////////////////////////////////////////////
  303. // callback type definition
  304. //
  305. //    ex.  this prints the row #'s, as they are processed, to the debug window
  306. //
  307. //    BOOL CALLBACK functionName(UINT curRow, UINT totalRows)
  308. //    {
  309. //        TRACE2("cur row : %u    total rows : %u\n",curRow, totalRows);
  310. //        return TRUE;
  311. //    }
  312. //
  313. //    ...
  314. //        ImgDLLSetCallback(functionName);
  315. //    ...
  316.  
  317. typedef BOOL (CALLBACK* CALLBACKPTR)(UINT uCurRow,                    // current row
  318.                                      UINT uHeight);
  319.  
  320. ////////////////////////////////////////////////////////////
  321. //
  322. //    void IMGEXP ImgDLLSetCallback(CALLBACKPTR pCallback);
  323. //
  324. //    Purpose :
  325. //    The DLL will call this function once for every scan line
  326. //    read or written to a JPG, PCX, TIFF, PNG or BMP file. if this function 
  327. //    returns FALSE the operation aborts and ImgDLLGetLastError 
  328. //    will return CALLBACKCANCEL
  329. //
  330. //    you can use this to monitor the progress of read / write operations.
  331. //
  332. //    It is not neccessary for you to use this function. If you do not
  333. //    set the callback function or pass a NULL to this call, no callback
  334. //    will be performed.
  335. //
  336. //    Param                Type            Use
  337. //    pCallback            CALLBACKPTR        ptr to a function defined to 
  338. //                                        accept 2 UINTs and return a BOOL.
  339. //    Return
  340. //        none
  341. //
  342. ////////////////////////////////////////////////////////////
  343.  
  344. void IMGEXP ImgDLLSetCallback(CALLBACKPTR pCallback);
  345.  
  346.  
  347. ////////////////////////////////////////////////////////////
  348. //
  349. //    BOOL IMGEXP ImgDLLSaveRGBToJPG(const char * fileName,
  350. //                        BYTE * pBuf,
  351. //                        UINT uWidthPix,
  352. //                        UINT uHeight,
  353. //                        UINT uQuality,
  354. //                        BOOL bColor)
  355. //
  356. //    Purpose :
  357. //        Save an RGB buffer to a JPG file . 
  358. //        Buffer must be packed RGB.
  359. //
  360. //        This will write all JPG text fields set by ImgDLLAddJPGText.
  361. //
  362. //        A JPG file may contain any number text fields (JPEG_COM markers).
  363. //    These strings can be any length. When ImgDLL reads a JPG file, 
  364. //    it stores these strings in the ImgDLL JPG text buffer. These 
  365. //    strings remain valid until :
  366. //
  367. //        1) BEFORE the next JPG file is read
  368. //        2) AFTER the next JPG is written
  369. //        3) ImgDLLClearJPGText is called
  370. //
  371. //        To prevent accidental copying of JPEG_COM markers, be sure to
  372. //    call ImgDLLClearJPGText before every JPG output operation (but
  373. //    before adding any new JPG text, of course).
  374. //
  375. //    Param                Type            Use
  376. //    fileName            const char *    path to open for writing
  377. //    pBuf                BYTE *            image buffer
  378. //    uWidthPix            UINT            width, in pixels
  379. //    uHeight                UINT            height, in pixels
  380. //    uQuality            UINT            quality from 1-100
  381. //    bColor                BOOL            FALSE = Grayscale
  382. //
  383. //    modifies global error value, check with    ImgDLLGetLastError()
  384. //
  385. //
  386. //    Return
  387. //        TRUE on success
  388. //
  389. ////////////////////////////////////////////////////////////
  390.  
  391. BOOL IMGEXP ImgDLLSaveRGBToJPG(const char * fileName,
  392.                         BYTE * pBuf,
  393.                         UINT uWidthPix,
  394.                         UINT uHeight,
  395.                         UINT uQuality,
  396.                         BOOL bColor);
  397.  
  398. ////////////////////////////////////////////////////////////
  399. //
  400. //BOOL IMGEXP ImgDLLGrayscaleToJPG(const char * fileName, 
  401. //                            BYTE *dataBuf,
  402. //                            UINT widthPix,
  403. //                            UINT height,
  404. //                            int quality);
  405. //
  406. //    Purpose :
  407. //        Save an 8-bit grayscale buffer to a JPG file . 
  408. //        Buffer must be 8 bit data. 0 for black 255 for white.
  409. //
  410. //        This will write all JPG text fields set by ImgDLLAddJPGText.
  411. //
  412. //        A JPG file may contain any number text fields (JPEG_COM markers).
  413. //    These strings can be any length. When ImgDLL reads a JPG file, 
  414. //    it stores these strings in the ImgDLL JPG text buffer. These 
  415. //    strings remain valid until :
  416. //
  417. //        1) BEFORE the next JPG file is read
  418. //        2) AFTER the next JPG is written
  419. //        3) ImgDLLClearJPGText is called
  420. //
  421. //        To prevent accidental copying of JPEG_COM markers, be sure to
  422. //    call ImgDLLClearJPGText before every JPG output operation (but
  423. //    before adding any new JPG text, of course).
  424. //
  425. //    Param                Type            Use
  426. //    fileName            const char *    path to open for writing
  427. //    pBuf                BYTE *            image buffer
  428. //    uWidthPix            UINT            width, in pixels
  429. //    uHeight                UINT            height, in pixels
  430. //    uQuality            UINT            quality from 1-100
  431. //
  432. //    modifies global error value, check with    ImgDLLGetLastError()
  433. //
  434. //
  435. //    Return
  436. //        TRUE on success
  437. //
  438. ////////////////////////////////////////////////////////////
  439.  
  440. BOOL IMGEXP ImgDLLGrayscaleToJPG(const char * fileName, 
  441.                             BYTE *dataBuf,
  442.                             UINT widthPix,
  443.                             UINT height,
  444.                             int quality);
  445.  
  446. ////////////////////////////////////////////////////////////
  447. //
  448. //    HGLOBAL IMGEXP ImgDLLRead8bitGrayscaleFromJPG(const char * fileName,
  449. //                             UINT *width,
  450. //                             UINT *height)
  451. //
  452. //    Purpose :
  453. //        Read a JPG file to a buffer of width * height bytes.
  454. //
  455. //        A JPG file may contain any number text fields (JPEG_COM markers).
  456. //    These strings can be any length. When ImgDLL reads a JPG file, 
  457. //    it stores these strings in the ImgDLL JPG text buffer. These 
  458. //    strings remain valid until :
  459. //
  460. //        1) BEFORE the next JPG file is read
  461. //        2) AFTER the next JPG is written
  462. //        3) ImgDLLClearJPGText is called
  463. //
  464. //        To prevent accidental copying of JPEG_COM markers, be sure to
  465. //    call ImgDLLClearJPGText before every JPG output operation (but
  466. //    before adding any new JPG text, of course).
  467. //
  468. //    Param                Type            Use
  469. //    fileName            const char *    path to open for reading
  470. //    uWidth                UINT*            width, in pixels
  471. //    uHeight                UINT*            height, in pixels
  472. //
  473. //    modifies global error value, check with    ImgDLLGetLastError()
  474. //
  475. //    Return
  476. //        HGLOBAL . 
  477. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  478. //        Caller is responsible for calling GlobalFree on this buffer!
  479. //
  480. ////////////////////////////////////////////////////////////
  481.  
  482. HGLOBAL IMGEXP ImgDLLRead8bitGrayscaleFromJPG(const char * fileName,
  483.                              UINT *width,
  484.                              UINT *height);
  485.  
  486. ////////////////////////////////////////////////////////////
  487. //
  488. //    UINT IMGEXP ImgDLLSaveRGBToJPGMem(BYTE * outBuf,
  489. //                                        UINT outBufSize,
  490. //                                        BYTE * inBuf,
  491. //                                        UINT uWidthPix,
  492. //                                        UINT uHeight,
  493. //                                        UINT uQuality,
  494. //                                        BOOL bColor)
  495. //
  496. //    Purpose :
  497. //        Save an RGB buffer to a JPG image in memory. Output
  498. //        buffer must have been previously allocated by the 
  499. //        caller. For safety, make this at least (width * height * 3) BYTEs.
  500. //
  501. //        Input buffer must be packed RGB.
  502. //
  503. //        This will write all JPG text fields set by ImgDLLAddJPGText.
  504. //
  505. //        A JPG file may contain any number text fields (JPEG_COM markers).
  506. //    These strings can be any length. When ImgDLL reads a JPG file, 
  507. //    it stores these strings in the ImgDLL JPG text buffer. These 
  508. //    strings remain valid until :
  509. //
  510. //        1) BEFORE the next JPG file is read
  511. //        2) AFTER the next JPG is written
  512. //        3) ImgDLLClearJPGText is called
  513. //
  514. //        To prevent accidental copying of JPEG_COM markers, be sure to
  515. //    call ImgDLLClearJPGText before every JPG output operation (but
  516. //    before adding any new JPG text, of course).
  517. //
  518. //
  519. //    Param                Type            Use
  520. //    outBuf                BYTE *            memory at which to write the JPG image
  521. //    outBufSize            UINT            size of output buffer in BYTEs
  522. //    pBuf                BYTE *            input image buffer
  523. //    uWidthPix            UINT            width, in pixels
  524. //    uHeight                UINT            height, in pixels
  525. //    uQuality            UINT            quality from 1-100
  526. //    bColor                BOOL            FALSE = Grayscale
  527. //
  528. //    modifies global error value, check with    ImgDLLGetLastError()
  529. //
  530. //
  531. //    Return
  532. //        UINT representing number of bytes actually written to memory.
  533. //
  534. ////////////////////////////////////////////////////////////
  535.  
  536.  
  537. UINT IMGEXP ImgDLLSaveRGBToJPGMem(BYTE * outBuf,
  538.                                     UINT outBufSize,
  539.                                     BYTE * inBuf,
  540.                                     UINT uWidthPix,
  541.                                     UINT uHeight,
  542.                                     UINT uQuality,
  543.                                     BOOL bColor);
  544.  
  545. ////////////////////////////////////////////////////////////
  546. //
  547. //    HGLOBAL IMGEXP ImgDLLReadRGBFromJPG(const char * fileName,
  548. //                             UINT *width,
  549. //                             UINT *height)
  550. //
  551. //
  552. //    Purpose :
  553. //        Read a JPG file to a buffer of RGB bytes.
  554. //
  555. //        A JPG file may contain any number text fields (JPEG_COM markers).
  556. //    These strings can be any length. When ImgDLL reads a JPG file, 
  557. //    it stores these strings in the ImgDLL JPG text buffer. These 
  558. //    strings remain valid until :
  559. //
  560. //        1) BEFORE the next JPG file is read
  561. //        2) AFTER the next JPG is written
  562. //        3) ImgDLLClearJPGText is called
  563. //
  564. //        To prevent accidental copying of JPEG_COM markers, be sure to
  565. //    call ImgDLLClearJPGText before every JPG output operation (but
  566. //    before adding any new JPG text, of course).
  567. //
  568. //    Param                Type            Use
  569. //    fileName            const char *    path to open for reading
  570. //    uWidth                UINT*            width, in pixels
  571. //    uHeight                UINT*            height, in pixels
  572. //
  573. //    modifies global error value, check with    ImgDLLGetLastError()
  574. //
  575. //    Return
  576. //        HGLOBAL . 
  577. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  578. //        Caller is responsible for calling GlobalFree on this buffer!
  579. //
  580. ////////////////////////////////////////////////////////////
  581. HGLOBAL IMGEXP ImgDLLReadRGBFromJPG(const char * fileName,
  582.                              UINT *width,
  583.                              UINT *height);
  584.  
  585. ////////////////////////////////////////////////////////////
  586. //
  587. //    HGLOBAL IMGEXP ImgDLLReadRGBFromJPGMem(BYTE * inBuf,   
  588. //                                            UINT inBufSize,
  589. //                                            UINT *width,
  590. //                                            UINT *height)
  591. //
  592. //    Purpose :
  593. //        Read a JPG memory stream to a buffer of RGB bytes.
  594. //
  595. //        A JPG file may contain any number text fields (JPEG_COM markers).
  596. //    These strings can be any length. When ImgDLL reads a JPG file, 
  597. //    it stores these strings in the ImgDLL JPG text buffer. These 
  598. //    strings remain valid until :
  599. //
  600. //        1) BEFORE the next JPG file is read
  601. //        2) AFTER the next JPG is written
  602. //        3) ImgDLLClearJPGText is called
  603. //
  604. //        To prevent accidental copying of JPEG_COM markers, be sure to
  605. //    call ImgDLLClearJPGText before every JPG output operation (but
  606. //    before adding any new JPG text, of course).
  607. //
  608. //    Param                Type            Use
  609. //    inBuf                BYTE *            buffer containing JPG file image
  610. //    inBufSize            UINT            size of input buffer
  611. //    uWidth                UINT*            width, in pixels
  612. //    uHeight                UINT*            height, in pixels
  613. //
  614. //    modifies global error value, check with    ImgDLLGetLastError()
  615. //
  616. //    Return
  617. //        HGLOBAL . 
  618. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  619. //        Caller is responsible for calling GlobalFree on this buffer!
  620. //
  621. ////////////////////////////////////////////////////////////
  622.  
  623. HGLOBAL IMGEXP ImgDLLReadRGBFromJPGMem(BYTE * inBuf,   
  624.                                             UINT inBufSize,
  625.                                             UINT *width,
  626.                                             UINT *height);
  627.  
  628. ////////////////////////////////////////////////////////////
  629. //
  630. //    HBITMAP IMGEXP ImgDLLReadHBITMAPFromJPG(const char * fileName,
  631. //                                            HPALETTE hPal)
  632. //
  633. //    Purpose :
  634. //        Read a JPG file to an HBITMAP - if hPal is non-NULL and the
  635. //    display is at <= 256 colors, hPal is used to render the image. 
  636. //    if NULL and display is <= 256 colors, the system palette will be used 
  637. //    instead.
  638. //
  639. //        A JPG file may contain any number text fields (JPEG_COM markers).
  640. //    These strings can be any length. When ImgDLL reads a JPG file, 
  641. //    it stores these strings in the ImgDLL JPG text buffer. These 
  642. //    strings remain valid until :
  643. //
  644. //        1) BEFORE the next JPG file is read
  645. //        2) AFTER the next JPG is written
  646. //        3) ImgDLLClearJPGText is called
  647. //
  648. //        To prevent accidental copying of JPEG_COM markers, be sure to
  649. //    call ImgDLLClearJPGText before every JPG output operation (but
  650. //    before adding any new JPG text, of course).
  651. //
  652. //    Param                Type            Use
  653. //    fileName            const char *    path to open for reading
  654. //    hPal                HPALETTE        palette
  655. //
  656. //    modifies global error value, check with    ImgDLLGetLastError()
  657. //
  658. //    Return
  659. //        HBITMAP - the new bitmap!
  660. //        
  661. //        be sure to call DeleteObject(..) on this when you're done!
  662. //
  663. ////////////////////////////////////////////////////////////
  664.  
  665. HBITMAP IMGEXP ImgDLLReadHBITMAPFromJPG(const char * fileName,
  666.                                         HPALETTE hPal);
  667.  
  668. ////////////////////////////////////////////////////////////
  669. //
  670. //    BOOL IMGEXP ImgDLLSaveRGBToBMP24(const char * fileName,
  671. //                        BYTE * pBuf,
  672. //                        UINT uWidthPix,
  673. //                        UINT uHeight)
  674. //
  675. //    Purpose :
  676. //        Save an RGB buffer to a 24-bit BMP file . 
  677. //        Buffer must be packed RGB (not DWORD aligned), 
  678. //        vertically oriented as viewed.
  679. //
  680. //
  681. //    Param                Type            Use
  682. //    fileName            const char *    path to open for writing
  683. //    pBuf                BYTE *            image buffer
  684. //    uWidthPix            UINT            width, in pixels
  685. //    uHeight                UINT            height, in pixels
  686. //
  687. //    modifies global error value, check with    ImgDLLGetLastError()
  688. //
  689. //
  690. //    Return
  691. //        TRUE on success
  692. //
  693. ////////////////////////////////////////////////////////////
  694.  
  695. BOOL IMGEXP ImgDLLSaveRGBToBMP24(const char * fileName,
  696.                         BYTE * pBuf,
  697.                         UINT uWidthPix,
  698.                         UINT uHeight);
  699.  
  700. ////////////////////////////////////////////////////////////
  701. //
  702. //    BOOL IMGEXP ImgDLLSaveColormappedToBMP(const char * fileName,
  703. //                                    BYTE * pBuf,
  704. //                                    UINT uWidthPix,
  705. //                                    UINT uHeight,
  706. //                                    UINT uBPP,
  707. //                                    UINT uColors,
  708. //                                    RGBQUAD *rgbPalette)
  709. //
  710. //
  711. //    Purpose :
  712. //        Save a colormapped buffer to a colormapped BMP file . 
  713. //        Buffer must be colormapped, 8-bit per pixel,
  714. //        vertically oriented as viewed. 
  715. //
  716. //
  717. //    Param                Type            Use
  718. //    fileName            const char *    path to open for writing
  719. //    pBuf                BYTE *            image buffer
  720. //    uWidthPix            UINT            width, in pixels
  721. //    uHeight                UINT            height, in pixels
  722. //    uBPP                UINT            bits per pixel to save as
  723. //    uColors                UINT            colors in palette
  724. //    rgbPalette            RGBQUAD *        palette array
  725. //
  726. //    modifies global error value, check with    ImgDLLGetLastError()
  727. //
  728. //
  729. //    Return
  730. //        TRUE on success
  731. //
  732. ////////////////////////////////////////////////////////////
  733.  
  734.  
  735. BOOL IMGEXP ImgDLLSaveColormappedToBMP(const char * fileName,
  736.                                     BYTE * pBuf,
  737.                                     UINT uWidthPix,
  738.                                     UINT uHeight,
  739.                                     UINT uBPP,
  740.                                     UINT uColors,
  741.                                     RGBQUAD *rgbPalette);
  742.  
  743. ////////////////////////////////////////////////////////////
  744. //
  745. //    BOOL IMGEXP ImgDLLSaveDIBColormappedToBMP(const char * fileName,
  746. //                                            BYTE * pBuf,
  747. //                                            BITMAPINFO * pBMI,
  748. //                                            RGBQUAD *colorMap)
  749. //
  750. //
  751. //    Purpose :
  752. //        Save a colormapped buffer to a colormapped BMP file . 
  753. //        Buffer must be in DIB format - 1,4,8,24 or 32 bits.
  754. //
  755. //
  756. //    Param                Type            Use
  757. //    fileName            const char *    path to open for writing
  758. //    pBuf                BYTE *            image buffer
  759. //    pBMI                BITMAPINFO *    filled in BITMAPINFO
  760. //    colorMap            RGBQUAD *        palette - ognored for 24-bit DIBs
  761. //
  762. //    modifies global error value, check with    ImgDLLGetLastError()
  763. //
  764. //
  765. //    Return
  766. //        TRUE on success
  767. //
  768. ////////////////////////////////////////////////////////////
  769.  
  770. BOOL IMGEXP ImgDLLSaveDIBColormappedToBMP(const char * fileName,
  771.                                             BYTE * pBuf,
  772.                                             BITMAPINFO * pBMI,
  773.                                             RGBQUAD *colorMap);
  774.  
  775. ////////////////////////////////////////////////////////////
  776. //
  777. //    HGLOBAL IMGEXP ImgDLLReadRGBFromBMP(const char * fileName,
  778. //                             UINT *width,
  779. //                             UINT *height)
  780. //
  781. //
  782. //    Purpose :
  783. //        Read a BMP file to a buffer of RGB bytes. Does not read
  784. //    RL-encoded BMP files.
  785. //
  786. //    Param                Type            Use
  787. //    fileName            const char *    path to open for reading
  788. //    uWidth                UINT*            width, in pixels
  789. //    uHeight                UINT*            height, in pixels
  790. //
  791. //    modifies global error value, check with    ImgDLLGetLastError()
  792. //
  793. //    Return
  794. //        HGLOBAL . 
  795. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  796. //        Caller is responsible for calling GlobalFree on this buffer!
  797. //
  798. ////////////////////////////////////////////////////////////
  799.  
  800.  
  801. HGLOBAL IMGEXP ImgDLLReadRGBFromBMP(const char * fileName,
  802.                                      UINT *width,
  803.                                      UINT *height);
  804.  
  805. ////////////////////////////////////////////////////////////
  806. //
  807. //    HBITMAP IMGEXP ImgDLLReadHBITMAPFromBMP(const char * fileName)
  808. //
  809. //
  810. //    Purpose :
  811. //        Read a BMP file to a HBITMAP.
  812. //
  813. //    Param                Type            Use
  814. //    fileName            const char *    path to open for reading
  815. //
  816. //    modifies global error value, check with    ImgDLLGetLastError()
  817. //
  818. //    Return
  819. //        HBITMAP - the new bitmap!
  820. //        
  821. //        be sure to call DeleteObject(..) on this when you're done!
  822. //
  823. ////////////////////////////////////////////////////////////
  824.  
  825. HBITMAP IMGEXP ImgDLLReadHBITMAPFromBMP(const char * fileName);
  826.  
  827.  
  828. ////////////////////////////////////////////////////////////
  829. //
  830. //    BOOL IMGEXP ImgDLLGetJPGDimensions(const char * fileName,
  831. //                            UINT *width,
  832. //                            UINT *height)
  833. //
  834. //    Purpose :
  835. //        Query a JPG file for image dimensions.
  836. //
  837. //        Because this will also fill the global JPG text buffers. You can
  838. //    use this function to fetch the JPEG_COM text without reading the
  839. //  pixel data.
  840. //
  841. //        A JPG file may contain any number text fields (JPEG_COM markers).
  842. //    These strings can be any length. When ImgDLL reads a JPG file, 
  843. //    it stores these strings in the ImgDLL JPG text buffer. These 
  844. //    strings remain valid until :
  845. //
  846. //        1) BEFORE the next JPG file is read
  847. //        2) AFTER the next JPG is written
  848. //        3) ImgDLLClearJPGText is called
  849. //
  850. //        To prevent accidental copying of JPEG_COM markers, be sure to
  851. //    call ImgDLLClearJPGText before every JPG output operation (but
  852. //    before adding any new JPG text, of course).
  853. //
  854. //    Param                Type            Use
  855. //    fileName            const char *    path to open for reading
  856. //    width                UINT*            width, in pixels
  857. //    height                UINT*            height, in pixels
  858. //
  859. //    modifies global error value, check with    ImgDLLGetLastError()
  860. //
  861. //    Return
  862. //        TRUE on success
  863. //
  864. ////////////////////////////////////////////////////////////
  865.  
  866.  
  867. BOOL IMGEXP ImgDLLGetJPGDimensions(const char * fileName,
  868.                             UINT *width,
  869.                             UINT *height);
  870.  
  871. ////////////////////////////////////////////////////////////
  872. //
  873. //  BOOL IMGEXP ImgDLLGetPNGDimensions(const char * fileName,
  874. //                          UINT *width,
  875. //                          UINT *height)
  876. //
  877. //  Purpose :
  878. //      Query a PNG file for image dimensions
  879. //
  880. //  Param               Type            Use
  881. //  fileName            const char *    path to open for reading
  882. //  width               UINT*           width, in pixels                                             
  883. //  height              UINT*           height, in pixels
  884. //
  885. //  modifies global error value, check with ImgLibGetLastError()
  886. //
  887. //  Return
  888. //      TRUE on success
  889. //
  890. ////////////////////////////////////////////////////////////
  891.  
  892. BOOL IMGEXP ImgDLLGetPNGDimensions(const char * fileName,
  893.                             UINT *width,
  894.                             UINT *height);
  895.  
  896. ////////////////////////////////////////////////////////////
  897. //
  898. //    BOOL IMGEXP ImgDLLGetBMPDimensions(const char * fileName,
  899. //                            UINT *width,
  900. //                            UINT *height)
  901. //
  902. //    Purpose :
  903. //        Query a BMP file for image dimensions
  904. //
  905. //    Param                Type            Use
  906. //    fileName            const char *    path to open for reading
  907. //    width                UINT*            width, in pixels
  908. //    height                UINT*            height, in pixels
  909. //
  910. //    modifies global error value, check with    ImgDLLGetLastError()
  911. //
  912. //    Return
  913. //        TRUE on success
  914. //
  915. ////////////////////////////////////////////////////////////
  916.  
  917. BOOL IMGEXP ImgDLLGetBMPDimensions(const char * fileName,
  918.                             UINT *width,
  919.                             UINT *height);
  920.  
  921. ////////////////////////////////////////////////////////////
  922. //
  923. //    BOOL IMGEXP ImgDLLGetTIFFDimensions(const char * fileName,
  924. //                            UINT *width,
  925. //                            UINT *height)
  926. //
  927. //    Purpose :
  928. //        Query a TIFF file for image dimensions
  929. //
  930. //    Param                Type            Use
  931. //    fileName            const char *    path to open for reading
  932. //    width                UINT*            width, in pixels
  933. //    height                UINT*            height, in pixels
  934. //
  935. //    modifies global error value, check with ImgDLLGetLastError()
  936. //
  937. //    Return
  938. //        TRUE on success
  939. //
  940. ////////////////////////////////////////////////////////////
  941.  
  942.  
  943. BOOL IMGEXP ImgDLLGetTIFFDimensions(const char * fileName,
  944.                             UINT *width,
  945.                             UINT *height);
  946.  
  947. ////////////////////////////////////////////////////////////
  948. //
  949. //    BOOL IMGEXP ImgDLLGetPCXDimensions(const char * fileName,
  950. //                            UINT *width,
  951. //                            UINT *height)
  952. //
  953. //    Purpose :
  954. //        Query a PCX file for image dimensions
  955. //
  956. //    Param                Type            Use
  957. //    fileName            const char *    path to open for reading
  958. //    width                UINT*            width, in pixels
  959. //    height                UINT*            height, in pixels
  960. //
  961. //    modifies global error value, check with ImgDLLGetLastError()
  962. //
  963. //    Return
  964. //        TRUE on success
  965. //
  966. ////////////////////////////////////////////////////////////
  967.  
  968. BOOL IMGEXP ImgDLLGetPCXDimensions(const char * fileName,
  969.                             UINT *width,
  970.                             UINT *height);
  971.  
  972. ////////////////////////////////////////////////////////////
  973. //
  974. //    HGLOBAL IMGEXP ImgDLLRGBFromDWORDAligned(BYTE *inBuf,
  975. //                                     UINT widthPix,
  976. //                                     UINT widthBytes,
  977. //                                    UINT height)
  978. //
  979. //    Purpose :
  980. //        Create a packed RGB buffer from a DWORD aligned buffer
  981. //
  982. //    Param                Type            Use
  983. //    inBuf                BYTE *            input buffer
  984. //    uWidthPix            UINT            width, in pixels
  985. //    uWidthBytes            UINT            width, in bytes    of input buffer
  986. //    uHeight                UINT            height, in pixels
  987. //
  988. //    modifies global error value, check with    ImgDLLGetLastError()
  989. //
  990. //    Return
  991. //        HGLOBAL to the buffer
  992. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  993. //        Caller is responsible for calling GlobalFree on this buffer!
  994. //
  995. ////////////////////////////////////////////////////////////
  996.  
  997.  
  998. HGLOBAL IMGEXP ImgDLLRGBFromDWORDAligned(BYTE *inBuf,
  999.                                     UINT widthPix,
  1000.                                      UINT widthBytes,
  1001.                                     UINT height);
  1002.  
  1003. ////////////////////////////////////////////////////////////
  1004. //
  1005. //    HGLOBAL IMGEXP ImgDLLDWORDAlignBuf(BYTE *dataBuf,
  1006. //                                        UINT widthPix,
  1007. //                                         UINT height,
  1008. //                                        UINT *uiOutWidthBytes)
  1009. //
  1010. //    Purpose :
  1011. //        Create a DWORD-aligned buffer from a packed RGB buffer
  1012. //
  1013. //    Param                Type            Use
  1014. //    dataBuf                BYTE *            input buffer
  1015. //    WidthPix            UINT            width, in pixels
  1016. //    height                UINT            height 
  1017. //    uiOutWidthBytes        UINT *            width, in bytes, of new buffer
  1018. //
  1019. //    modifies global error value, check with    ImgDLLGetLastError()
  1020. //
  1021. //    Return
  1022. //        HGLOBAL to the buffer
  1023. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  1024. //        Caller is responsible for calling GlobalFree on this buffer!
  1025. //
  1026. ////////////////////////////////////////////////////////////
  1027.  
  1028.  
  1029. HGLOBAL IMGEXP ImgDLLDWORDAlignBuf(BYTE *dataBuf,
  1030.                                      UINT widthPix,        // pixels!!
  1031.                                      UINT height,
  1032.                                      UINT *uiOutWidthBytes);
  1033.  
  1034. ////////////////////////////////////////////////////////////
  1035. //
  1036. //    HGLOBAL IMGEXP ImgDLLDWORDAlignBuf(BYTE *dataBuf,
  1037. //                                        UINT widthBytes,
  1038. //                                         UINT height,
  1039. //                                        UINT *uiOutWidthBytes)
  1040. //
  1041. //    Purpose :
  1042. //        Create a DWORD-aligned buffer from a buffer
  1043. //
  1044. //    Param                Type            Use
  1045. //    dataBuf                BYTE *            input buffer
  1046. //    WidthBytes            UINT            width, in bytes
  1047. //    height                UINT            height 
  1048. //    uiOutWidthBytes        UINT *            width, in bytes, of new buffer
  1049. //
  1050. //    modifies global error value, check with    ImgDLLGetLastError()
  1051. //
  1052. //    Return
  1053. //        HGLOBAL to the buffer
  1054. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  1055. //        Caller is responsible for calling GlobalFree on this buffer!
  1056. //
  1057. ////////////////////////////////////////////////////////////
  1058.  
  1059. HGLOBAL IMGEXP ImgDLLDWORDAlignBufBytes(BYTE *dataBuf,
  1060.                                      UINT widthBytes,        // bytes!!
  1061.                                      UINT height,
  1062.                                      UINT *uiOutWidthBytes);// bytes!!!
  1063.  
  1064. ////////////////////////////////////////////////////////////
  1065. //
  1066. //    BOOL IMGEXP ImgDLLVerticalFlipBuf(BYTE  * inbuf, 
  1067. //                                        UINT widthBytes,
  1068. //                                         UINT height)
  1069. //
  1070. //    Purpose :
  1071. //        Vertically flip buffer
  1072. //
  1073. //    Param                Type            Use
  1074. //    inbuf                BYTE *            input buffer
  1075. //    widthBytes            UINT            width, in bytes
  1076. //    height                UINT            height 
  1077. //
  1078. //    modifies global error value, check with    ImgDLLGetLastError()
  1079. //
  1080. //    Return
  1081. //        TRUE on success
  1082. //
  1083. ////////////////////////////////////////////////////////////
  1084.  
  1085. BOOL IMGEXP ImgDLLVerticalFlipBuf(BYTE  * inbuf, 
  1086.                        UINT widthBytes, 
  1087.                        UINT height);
  1088.  
  1089. ////////////////////////////////////////////////////////////
  1090. //
  1091. //    BOOL IMGEXP ImgDLLBGRFromRGB(BYTE *buf, UINT widthPix, UINT height)
  1092. //
  1093. //    Purpose :
  1094. //        Swap red and blue values in a buffer
  1095. //
  1096. //    Param                Type            Use
  1097. //    dataBuf                BYTE *            buffer
  1098. //    WidthPix            UINT            width, in pixels
  1099. //    height                UINT            height 
  1100. //
  1101. //    modifies global error value, check with    ImgDLLGetLastError()
  1102. //
  1103. //    Return
  1104. //        TRUE on success
  1105. //
  1106. ////////////////////////////////////////////////////////////
  1107.  
  1108.  
  1109. BOOL IMGEXP ImgDLLBGRFromRGB(BYTE *buf, UINT widthPix, UINT height);
  1110. ////////////////////////////////////////////////////////////
  1111. //
  1112. //    BOOL IMGEXP ImgDLLSetAlphaChannelToImage(BYTE *destRGBA,
  1113. //                                        UINT w,
  1114. //                                        UINT h,
  1115. //                                        BYTE *alphaImage);
  1116. //
  1117. //    Purpose :
  1118. //        Fill in the bytes of the alpha channel in an RGBA image.
  1119. //
  1120. //    Param            Type            Use
  1121. //    destRGBA        BYTE *            32-bit RGBA image to receive new alpha data
  1122. //    w                UINT            width in pixels
  1123. //    h                UINT            height
  1124. //    alphaImage        BYTE *            8-bit image that will become the alpha channel
  1125. //
  1126. //    Return
  1127. //        FALSE on failure
  1128. //
  1129. ////////////////////////////////////////////////////////////
  1130.  
  1131. BOOL IMGEXP ImgDLLSetAlphaChannelToImage(BYTE *destRGBA,
  1132.                                         UINT w,
  1133.                                         UINT h,
  1134.                                         BYTE *alphaImage);
  1135.  
  1136. ////////////////////////////////////////////////////////////
  1137. //
  1138. //    HGLOBAL IMGEXP  ImgDLLRGBAFromRGB24(BYTE *inBuf,
  1139. //                            UINT widthPix,
  1140. //                            UINT height,
  1141. //                            BYTE defAlpha)
  1142. //
  1143. //    Purpose :
  1144. //        Given a 24-bit RGB image, create a 32-bit RGBA image.
  1145. //    The alpha channel will be set to defAlpha.
  1146. //
  1147. //    Param            Type            Use
  1148. //    inBuf            BYTE *            24-bit RGB image
  1149. //    widthPix        UINT            width in pixels
  1150. //    height            UINT            height
  1151. //    defAlpha        BYTE             default value for all aplha BYTEs
  1152. //
  1153. //    Return
  1154. //        HGLOBAL to new buffer
  1155. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  1156. //        Caller is responsible for calling GlobalFree on this buffer!
  1157. ////////////////////////////////////////////////////////////
  1158.  
  1159. HGLOBAL IMGEXP ImgDLLRGBAFromRGB24(BYTE *inBuf,
  1160.                             UINT widthPix,
  1161.                             UINT height,
  1162.                             BYTE defAlpha);
  1163.  
  1164. ////////////////////////////////////////////////////////////
  1165. //
  1166. //    BOOL IMGEXP ImgDLLMake8BitGrayScale(BYTE *inBuf, 
  1167. //                                    UINT widthPix, 
  1168. //                                    UINT height,
  1169. //                                    BYTE *outBuf)
  1170. //
  1171. //    Purpose :
  1172. //        convert RGB to 8-bir grayscale uses luminance formula.
  1173. //
  1174. //    Param                Type            Use
  1175. //    inBuf                BYTE *            input RGB buffer
  1176. //    widthPix            UINT            width, in pixels
  1177. //    height                UINT            height 
  1178. //    outBuf                BYTE *            output 8-bit buffer
  1179. //
  1180. //    modifies global error value, check with    ImgDLLGetLastError()
  1181. //
  1182. //    Return
  1183. //        TRUE on success
  1184. //
  1185. ////////////////////////////////////////////////////////////
  1186. BOOL IMGEXP ImgDLLMake8BitGrayScale(BYTE *inBuf, 
  1187.                                     UINT widthPix, 
  1188.                                     UINT height, 
  1189.                                     BYTE *outBuf);
  1190.  
  1191. ////////////////////////////////////////////////////////////
  1192. //
  1193. //    BOOL IMGEXP ImgDLLMakeGrayScale(BYTE *buf, UINT widthPix, UINT height)
  1194. //
  1195. //    Purpose :
  1196. //        convert RGB to GGG (all three bytes the same). 
  1197. //    uses luminance formula.
  1198. //
  1199. //    Param                Type            Use
  1200. //    dataBuf                BYTE *            buffer
  1201. //    WidthPix            UINT            width, in pixels
  1202. //    height                UINT            height 
  1203. //
  1204. //    modifies global error value, check with    ImgDLLGetLastError()
  1205. //
  1206. //    Return
  1207. //        TRUE on success
  1208. //
  1209. ////////////////////////////////////////////////////////////
  1210.  
  1211. BOOL IMGEXP ImgDLLMakeGrayScale(BYTE *buf, UINT widthPix, UINT height);
  1212.  
  1213. ////////////////////////////////////////////////////////////
  1214. //
  1215. //    BOOL IMGEXP ImgDLLHorizontalFlipRGB(BYTE  * inbuf, 
  1216. //                                        UINT widthPix,
  1217. //                                         UINT height)
  1218. //
  1219. //    Purpose :
  1220. //        Horizontally flip a buffer of RGB pixels
  1221. //
  1222. //    Param                Type            Use
  1223. //    dataBuf                BYTE *            input buffer
  1224. //    widthPix            UINT            width, in pixels
  1225. //    height                UINT            height 
  1226. //
  1227. //    modifies global error value, check with    ImgDLLGetLastError()
  1228. //
  1229. //    Return
  1230. //        HGLOBAL to the buffer
  1231. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  1232. //        Caller is responsible for calling GlobalFree on this buffer!
  1233. //
  1234. ////////////////////////////////////////////////////////////
  1235.  
  1236.  
  1237. BOOL IMGEXP ImgDLLHorizontalFlipRGB(BYTE  * inbuf, 
  1238.                                        UINT widthPix, 
  1239.                                        UINT height);
  1240.  
  1241. ////////////////////////////////////////////////////////////
  1242. //
  1243. //    BOOL IMGDLLEXP ImgDLLResizeRGB2(BYTE * rgbIn,
  1244. //                            UINT inWidth,
  1245. //                            UINT inHeight,
  1246. //                            BYTE *rgbOut,
  1247. //                            UINT outWidth,
  1248. //                            UINT outHeight)
  1249. //
  1250. //    Purpose :
  1251. //        given an RGB image, resize it to the dimensions specified.
  1252. //
  1253. //    Param                Type            Use
  1254. //    rgbIn                BYTE *            24-bit RGB image data
  1255. //    inWidth                UINT            input width
  1256. //    inHeight            UINT            input height
  1257. //    rgbOut                BYTE *            buffer to receive image
  1258. //    outWidth            UINT            output height
  1259. //    outHeight            UINT            output width
  1260. //
  1261. //    modifies global error value, check with    ImgDLLGetLastError()
  1262. //
  1263. //    Return
  1264. //        FALSE on failure
  1265. //
  1266. ////////////////////////////////////////////////////////////
  1267.  
  1268. BOOL IMGEXP ImgDLLResizeRGB2(BYTE * rgbIn,
  1269.                             UINT inWidth,
  1270.                             UINT inHeight,
  1271.                             BYTE *rgbOut,
  1272.                             UINT outWidth,
  1273.                             UINT outHeight);
  1274.  
  1275. ////////////////////////////////////////////////////////////
  1276. //
  1277. //    HGLOBAL IMGEXP ImgDLLResizeRGB(BYTE * rgbIn,
  1278. //                            UINT inWidth,
  1279. //                            UINT inHeight,
  1280. //                            UINT outWidth,
  1281. //                            UINT outHeight)
  1282. //
  1283. //    Purpose :
  1284. //        given an RGB image, resize it to the dimensions specified.
  1285. //        return a handle to the new image.
  1286. //
  1287. //    Param                Type            Use
  1288. //    rgbIn                BYTE *            24-bit RGB image data
  1289. //    inWidth                UINT            input width
  1290. //    inHeight            UINT            input height
  1291. //    outWidth            UINT            output height
  1292. //    outHeight            UINT            output width
  1293. //
  1294. //    modifies global error value, check with    ImgDLLGetLastError()
  1295. //
  1296. //    Return
  1297. //        NULL on failure
  1298. //
  1299. ////////////////////////////////////////////////////////////
  1300.  
  1301. HGLOBAL IMGEXP ImgDLLResizeRGB(BYTE * rgbIn,
  1302.                             UINT inWidth,
  1303.                             UINT inHeight,
  1304.                             UINT outWidth,
  1305.                             UINT outHeight);
  1306.  
  1307. ////////////////////////////////////////////////////////////
  1308. //
  1309. //  HGLOBAL IMGEXP ImgDLLDecimateRGB(BYTE * rgbIn,
  1310. //                          UINT inWidth,
  1311. //                          UINT inHeight,
  1312. //                          UINT outWidth,
  1313. //                          UINT outHeight)
  1314. //
  1315. //  Purpose :
  1316. //      given an RGB image, resize it to the dimensions specified.
  1317. //      return a handle to the new image.
  1318. //      This uses a different algorithm than ResizeRGB. This is a
  1319. //      pixel averaging algorithm which can produce better images than
  1320. //      ResizeRGB. This works only when reducing images. 
  1321. //
  1322. //      ** This will not enlarge images **
  1323. //
  1324. //  Param           Type            Use
  1325. //  rgbIn           BYTE *          24-bit RGB image data
  1326. //  inWidth         UINT            input width         ( > output width )
  1327. //  inHeight        UINT            input height        ( > output height )
  1328. //  outWidth        UINT            output height
  1329. //  outHeight       UINT            output width
  1330. //
  1331. //  modifies global error value, check with ImgDLLGetLastError()
  1332. //
  1333. //  Return
  1334. //      NULL on failure
  1335. //
  1336. ////////////////////////////////////////////////////////////
  1337.  
  1338. HGLOBAL IMGEXP ImgDLLDecimateRGB(BYTE * rgbIn,
  1339.                             UINT inWidth,
  1340.                             UINT inHeight,
  1341.                             UINT outWidth,
  1342.                             UINT outHeight);
  1343.  
  1344. ////////////////////////////////////////////////////////////
  1345. //
  1346. //  BOOL IMGEXP ImgDLLResizeRGB2(BYTE * rgbIn,
  1347. //                          UINT inWidth,
  1348. //                          UINT inHeight,
  1349. //                          BYTE *rgbOut,
  1350. //                          UINT outWidth,
  1351. //                          UINT outHeight)
  1352. //
  1353. //  Purpose :
  1354. //      given an RGB image, resize it to the dimensions specified.
  1355. //      return a handle to the new image.
  1356. //      This uses a different algorithm than ResizeRGB. This is a
  1357. //      pixel averaging algorithm which can produce better image than
  1358. //      ResizeRGB. This works only when reducing images. 
  1359. //
  1360. //      ** This will not enlarge images **
  1361. //
  1362. //  Param           Type            Use
  1363. //  rgbIn           BYTE *      24-bit RGB image data
  1364. //  inWidth         UINT            input width
  1365. //  inHeight        UINT            input height
  1366. //  rgbOut          BYTE *      buffer to receive image
  1367. //  outWidth        UINT            output height
  1368. //  outHeight       UINT            output width
  1369. //
  1370. //  modifies global error value, check with ImgDLLGetLastError()
  1371. //
  1372. //  Return
  1373. //      NULL on failure
  1374. //
  1375. ////////////////////////////////////////////////////////////
  1376.  
  1377. BOOL IMGEXP ImgDLLDecimateRGB2(BYTE * rgbIn,
  1378.                               UINT inWidth,
  1379.                               UINT inHeight,
  1380.                               BYTE *rgbOut,
  1381.                               UINT outWidth,
  1382.                               UINT outHeight);
  1383.  
  1384. ////////////////////////////////////////////////////////////
  1385. //
  1386. //    BOOL IMGEXP ImgDLLSharpenRGB(BYTE * rgbIn,
  1387. //                            BYTE * rgbOut,
  1388. //                            UINT widthPix,
  1389. //                            UINT height,
  1390. //                            UINT sharpLevel)
  1391. //
  1392. //
  1393. //    Purpose :
  1394. //        sharpen an RGB buffer into a different RGB buffer. 3 x 3 matrix
  1395. //
  1396. //        buffers must be the same size!!!
  1397. //
  1398. //        rgbIn must not be the same as rgbOut !!!
  1399. //
  1400. //    Param                Type            Use
  1401. //    rgbIn                BYTE *            24-bit RGB image data
  1402. //    rgbOut                BYTE *            24-bit RGB image data
  1403. //    widhtPix            UINT            width in pixels
  1404. //    height                UINT            height
  1405. //    sharpLevel            UINT            0..100 sharpening intensity
  1406. //
  1407. //    modifies global error value, check with    ImgDLLGetLastError()
  1408. //
  1409. //    Return
  1410. //        NULL on failure
  1411. //
  1412. ////////////////////////////////////////////////////////////
  1413.  
  1414. BOOL IMGEXP ImgDLLSharpenRGB(BYTE * rgbIn,
  1415.                             BYTE * rgbOut,
  1416.                             UINT widthPix,
  1417.                             UINT height,
  1418.                             UINT sharpLevel);
  1419.  
  1420. ////////////////////////////////////////////////////////////
  1421. //
  1422. //    BOOL IMGEXP ImgDLLBlurRGB(BYTE * rgbIn,
  1423. //                            BYTE * rgbOut,
  1424. //                            UINT widthPix,
  1425. //                            UINT height,
  1426. //                            UINT blurLevel)
  1427. //
  1428. //
  1429. //    Purpose :
  1430. //        blur an RGB buffer into a different RGB buffer. 3 x 3 matrix
  1431. //
  1432. //        buffers must be the same size!!!
  1433. //
  1434. //        rgbIn must not be the same as rgbOut !!!
  1435. //
  1436. //    Param                Type            Use
  1437. //    rgbIn                BYTE *            24-bit RGB image data
  1438. //    rgbOut                BYTE *            24-bit RGB image data
  1439. //    widhtPix            UINT            width in pixels
  1440. //    height                UINT            height
  1441. //    blurLevel            UINT            0..100 blur intensity
  1442. //
  1443. //    modifies global error value, check with    ImgDLLGetLastError()
  1444. //
  1445. //    Return
  1446. //        NULL on failure
  1447. //
  1448. ////////////////////////////////////////////////////////////
  1449.  
  1450. BOOL IMGEXP ImgDLLBlurRGB(BYTE * rgbIn,
  1451.                             BYTE * rgbOut,
  1452.                             UINT widthPix,
  1453.                             UINT height,
  1454.                             UINT blurLevel);
  1455.  
  1456. ////////////////////////////////////////////////////////////
  1457. //
  1458. //    BOOL IMGEXP ImgDLLQuantizeRGBTo8Bit(BYTE *inBuf,
  1459. //                                        BYTE *outBuf,
  1460. //                                        UINT widthPix,
  1461. //                                        UINT height,
  1462. //                                        UINT colors,
  1463. //                                        RGBQUAD *pPal)
  1464. //
  1465. //    Purpose :
  1466. //        generate a palette and a dithered image with the specified
  1467. //    number of colors.    
  1468. //
  1469. //        The output buffer must be widthPix * height pixels !
  1470. //
  1471. //        The output buffer is an 8-bit image. 
  1472. //
  1473. //        Ex. If you ask for a 16-color image, the pixels will be 
  1474. //    placed one-per-byte, even though there are only 4 significant 
  1475. //    bits (2^4 = 16 colors) per pixel.
  1476. //
  1477. //    Param                Type            Use
  1478. //    inBuf                BYTE *            input image
  1479. //    outBuf                BYTE *            output image
  1480. //    widthPix            UINT             width
  1481. //    height                UINT             height
  1482. //    colors                UINT            colors to reduce to    (1..256)
  1483. //    pPal                RGBQUAD *        ptr to an array of RGBQUADs. 
  1484. //                                        there must be at least "colors" 
  1485. //                                        entries. this receives the
  1486. //                                        new palette.
  1487. //
  1488. //    modifies global error value, check with    ImgDLLGetLastError()
  1489. //
  1490. //    Return
  1491. //        FALSE on failure
  1492. //
  1493. ////////////////////////////////////////////////////////////
  1494.  
  1495. BOOL IMGEXP ImgDLLQuantizeRGBTo8Bit(BYTE *inBuf,
  1496.                                         BYTE *outBuf,
  1497.                                         UINT widthPix,
  1498.                                         UINT height,
  1499.                                         UINT colors,
  1500.                                         RGBQUAD *pPal);
  1501.  
  1502. ////////////////////////////////////////////////////////////
  1503. //
  1504. //    BOOL IMGEXP ImgDLLGet8BitPalette(BYTE *inbuf, 
  1505. //                                    UINT nWidth, 
  1506. //                                    UINT nHeight, 
  1507. //                                    UINT nColors,
  1508. //                                    RGBQUAD *pPal);
  1509. //
  1510. //    Purpose :
  1511. //        generate a palette with the specified number of colors. does not
  1512. //    generate an output image. does not affect the input image.
  1513. //
  1514. //    Param                Type            Use
  1515. //    inBuf                BYTE *            input image
  1516. //    widthPix            UINT             width
  1517. //    height                UINT             height
  1518. //    colors                UINT            colors to reduce to    (1..256)
  1519. //    pPal                RGBQUAD *        ptr to an array of RGBQUADs. there must be at
  1520. //                                        least "colors" entries. this receives the
  1521. //                                        new palette.
  1522. //
  1523. //    modifies global error value, check with    ImgDLLGetLastError()
  1524. //
  1525. //    Return
  1526. //        FALSE on failure
  1527. //
  1528. ////////////////////////////////////////////////////////////
  1529.  
  1530. BOOL IMGEXP ImgDLLGet8BitPalette(BYTE *inbuf, 
  1531.                                     UINT nWidth, 
  1532.                                     UINT nHeight, 
  1533.                                     UINT nColors,
  1534.                                     RGBQUAD *pPal);
  1535.  
  1536. ////////////////////////////////////////////////////////////
  1537. //
  1538. //    BOOL IMGEXP ImgDLLRGBFrom8Bit(BYTE *inBuf,
  1539. //                                BYTE *outBuf,
  1540. //                                UINT widthPix,
  1541. //                                UINT height,
  1542. //                                UINT colors,
  1543. //                                RGBQUAD *pPal)
  1544. //
  1545. //    Purpose :
  1546. //        apply a palette to an 8-bit image to generate an equivalent
  1547. //    24-bit image.
  1548. //
  1549. //    Param                Type            Use
  1550. //    inBuf                BYTE *            input image
  1551. //    outBuf                BYTE *            output image (widthPix * height * 3 BYTEs)
  1552. //    widthPix            UINT             width
  1553. //    height                UINT             height
  1554. //    colors                UINT            colors in palette
  1555. //    pPal                RGBQUAD *        ptr to an array of RGBQUADs. there must be at
  1556. //                                        least "colors" entries.
  1557. //
  1558. //    modifies global error value, check with    ImgDLLGetLastError()
  1559. //
  1560. //    Return
  1561. //        FALSE on failure
  1562. //
  1563. ////////////////////////////////////////////////////////////
  1564.  
  1565. BOOL IMGEXP ImgDLLRGBFrom8Bit(BYTE *inBuf,
  1566.                                 BYTE *outBuf,
  1567.                                 UINT widthPix,
  1568.                                 UINT height,
  1569.                                 UINT colors,
  1570.                                 RGBQUAD *pPal);
  1571.  
  1572.  
  1573. ////////////////////////////////////////////////////////////
  1574. //
  1575. //    HGLOBAL IMGEXP ImgDLLDIBToRGB( BYTE * inBuf,
  1576. //                                    BITMAPINFOHEADER *pBMI,
  1577. //                                    RGBQUAD * colorMap)
  1578. //    Purpose :
  1579. //        given an image in DIB format, create a 24-bit RGB buffer
  1580. //
  1581. //    Param            Type                Use
  1582. //    inBuf            BYTE *                DI-Bits
  1583. //    pBMI            BITMAPINFOHEADER *    a filled-in BMIH
  1584. //    colorMap        RGBQUAD *            space large enough to hold a palette
  1585. //
  1586. //    modifies global error value, check with    ImgDLLGetLastError()
  1587. //
  1588. //    Return
  1589. //        TRUE on success
  1590. //
  1591. ////////////////////////////////////////////////////////////
  1592.  
  1593. HGLOBAL IMGEXP ImgDLLDIBToRGB( BYTE * inBuf,
  1594.                                 BITMAPINFOHEADER *pBMI,
  1595.                                 RGBQUAD * colorMap);
  1596.  
  1597.  
  1598. ////////////////////////////////////////////////////////////
  1599. //
  1600. //    HGLOBAL IMGEXP ImgDLLDIBToRGB2(BYTE * pDIB,
  1601. //                                UINT *width, 
  1602. //                                UINT *height)
  1603. //
  1604. //    Purpose :
  1605. //        given a DIB, create an RGB buffer, using the 
  1606. //    screen device driver to generate 1,4,8 bits per pixel images.
  1607. //    all returned in 24-bit buffers!!
  1608. //
  1609. //    Param                Type            Use
  1610. //    inhBmp                BYTE *            BYTE ptr to DIB 
  1611. //    width                UINT *            width
  1612. //    height                UINT *            height
  1613. //
  1614. //    modifies global error value, check with    ImgDLLGetLastError()
  1615. //
  1616. //    Return
  1617. //        NULL on failure
  1618. //
  1619. ////////////////////////////////////////////////////////////
  1620.  
  1621. HGLOBAL IMGEXP ImgDLLDIBToRGB2(BYTE * pDIB,
  1622.                                 UINT *width, 
  1623.                                 UINT *height);
  1624.  
  1625. ////////////////////////////////////////////////////////////
  1626. //
  1627. //    HGLOBAL IMGEXP ImgDLLRGBToDIB( BYTE * inBuf,
  1628. //                                UINT widthPix,
  1629. //                                UINT height)
  1630. //    Purpose :
  1631. //        given a 24-bit RGB image, create a 24-bit DIB. 
  1632. //
  1633. //    Param                Type            Use
  1634. //    inBuf                BYTE *            RGB buffer
  1635. //    widthPix            UINT            buffer width in pixels
  1636. //    height                UINT            height
  1637. //
  1638. //    modifies global error value, check with    ImgDLLGetLastError()
  1639. //
  1640. //    Return
  1641. //        NULL on failure
  1642. //
  1643. ////////////////////////////////////////////////////////////
  1644. HGLOBAL IMGEXP ImgDLLRGBToDIB( BYTE * inBuf,
  1645.                                 UINT widthPix,
  1646.                                 UINT height);
  1647.  
  1648. ////////////////////////////////////////////////////////////
  1649. //
  1650. //    HGLOBAL IMGEXP ImgDLLHBITMAPToRGB(HBITMAP inhBmp, 
  1651. //                                  UINT *width, 
  1652. //                                  UINT *height)
  1653. //
  1654. //    Purpose :
  1655. //        given an HBITMAP create an RGB buffer, using the 
  1656. //    screen device driver to generate 1,4,8 bits per pixel images.
  1657. //    all returned in 24-bit buffers!!
  1658. //
  1659. //    Param                Type            Use
  1660. //    inhBmp                HBITMAP            handle to bitmap
  1661. //    width                UINT *            width
  1662. //    height                UINT *            height
  1663. //    hPal                HPALETTE        palette to use in rendering the image.
  1664. //                                        if NULL, the system palette is used
  1665. //
  1666. //    modifies global error value, check with    ImgDLLGetLastError()
  1667. //
  1668. //    Return
  1669. //        NULL on failure
  1670. //
  1671. ////////////////////////////////////////////////////////////
  1672.  
  1673. HGLOBAL IMGEXP ImgDLLHBITMAPToRGB(HBITMAP inhBmp, 
  1674.                                   UINT *width, 
  1675.                                   UINT *height,
  1676.                                   HPALETTE hPal);
  1677.  
  1678. ////////////////////////////////////////////////////////////
  1679. //
  1680. //    HBITMAP IMGEXP ImgDLLRGBToHBITMAP( BYTE * inBuf,
  1681. //                                UINT widthPix,
  1682. //                                UINT height,
  1683. //                                HPALETTE hPal)
  1684. //    Purpose :
  1685. //        given a 24-bit RGB image, create a DIB. 
  1686. //
  1687. //    if hPal is non-NULL and the display is at <= 256 colors, 
  1688. //    hPal is used to render the image. if NULL and display is <= 
  1689. //    256 colors, the system palette will be used instead.
  1690. //
  1691. //    Param                Type            Use
  1692. //    inBuf                BYTE *            RGB buffer
  1693. //    widthPix            UINT            buffer width in pixels
  1694. //    height                UINT            height
  1695. //    hPal                HPALETTE        palette
  1696. //
  1697. //    modifies global error value, check with    ImgDLLGetLastError()
  1698. //
  1699. //    Return
  1700. //        NULL on failure
  1701. //
  1702. ////////////////////////////////////////////////////////////
  1703. HBITMAP IMGEXP ImgDLLRGBToHBITMAP( BYTE * inBuf,
  1704.                                 UINT widthPix,
  1705.                                 UINT height,
  1706.                                 HPALETTE hPal);
  1707.  
  1708. ////////////////////////////////////////////////////////////
  1709. //
  1710. //    HGLOBAL IMGEXP ImgDLLDCToRGB(HDC hDC,
  1711. //                                UINT uXStart,
  1712. //                                UINT uYStart,
  1713. //                                UINT uWidth,
  1714. //                                UINT uHeight)
  1715. //    Purpose :
  1716. //        Copy a rectangle of pixels in the given HDC to an RGB buffer.
  1717. //
  1718. //        RGB buffer dimensions are  (uWidth - uXStart) x (uHeight - uYStart)
  1719. //
  1720. //    Param                Type            Use
  1721. //    uXStart            UINT            left side of the pixel rect
  1722. //    uYStart            UINT            top of the pixel rect
  1723. //    uWidth            UINT            width of the pixel rect
  1724. //    uHeight            UINT            height of the pixel rect
  1725. //
  1726. //    modifies global error value, check with ImgDLLGetLastError()
  1727. //
  1728. //    Return
  1729. //        NULL on failure
  1730. //
  1731. ////////////////////////////////////////////////////////////
  1732.  
  1733. HGLOBAL IMGEXP ImgDLLDCToRGB(HDC hDC,
  1734.                                 UINT uXStart,
  1735.                                 UINT uYStart,
  1736.                                 UINT uWidth,
  1737.                                 UINT uHeight);
  1738.  
  1739. ////////////////////////////////////////////////////////////
  1740. //
  1741. //    BOOL IMGEXP ImgDLLDrawHBITMAP(HDC outHDC, 
  1742. //                                HBITMAP hBmp,
  1743. //                                int xPos,
  1744. //                                int yPos,
  1745. //                                UINT outWidth,
  1746. //                                UINT outHeight,
  1747. //                                HPALETTE hPal)
  1748. //
  1749. //    Purpose :
  1750. //        given an HBITMAP and an HDC, draw the image to the DC. this
  1751. //    is just a quick way to do the usual CreateCompatibleDC, SelectObject,
  1752. //    BitBlt stuff.
  1753. //
  1754. //    Param                Type            Use
  1755. //    outHDC                HDC                device context to draw into
  1756. //    hBmp                HBITMAP            handle to bitmap
  1757. //    xPos                int                X position in DC to draw at
  1758. //    yPos                int                Y position in DC to draw at
  1759. //    outWidth            UINT             width of dest rect
  1760. //    outHeight            UINT             height of dest rect
  1761. //    hPal                HPALETTE        palette to use in rendering the image.
  1762. //                                        if NULL, the system palette is used
  1763. //
  1764. //    modifies global error value, check with    ImgDLLGetLastError()
  1765. //
  1766. //    Return
  1767. //        FALSE on failure
  1768. //
  1769. ////////////////////////////////////////////////////////////
  1770.  
  1771. BOOL IMGEXP ImgDLLDrawHBITMAP(HDC outHDC, 
  1772.                                 HBITMAP hBmp,
  1773.                                 int xPos,
  1774.                                 int yPos,
  1775.                                 UINT outWidth,
  1776.                                 UINT outHeight,
  1777.                                 HPALETTE hPal);
  1778.  
  1779. ////////////////////////////////////////////////////////////
  1780. //
  1781. //    BOOL IMGEXP ImgDLLDrawRGB(HDC outDC,
  1782. //                            BYTE *pRGB,
  1783. //                            UINT inWidth,
  1784. //                            UINT inHeight,
  1785. //                            int xPos,
  1786. //                            int yPos,
  1787. //                            UINT outWidth,
  1788. //                            UINT outHeight,
  1789. //                            HPALETTE hPal)
  1790. //    Purpose :
  1791. //        given a 24-bit RGB image and an HDC, draw the image to the DC.
  1792. //    this call wraps a call to ImgDLLRGBToHBITMAP as well as all the
  1793. //    usual CreateCompatibleDC, SelectObject, BitBlt stuff
  1794. //
  1795. //    Param                Type            Use
  1796. //    outHDC                HDC                device context to draw into
  1797. //    pRGB                BYTE *            RGB (24-bit) image
  1798. //    inWidth                UINT            width of RGB image
  1799. //    inHeight            UINT            height of RGB image
  1800. //    xPos                int                X position in DC to draw at
  1801. //    yPos                int                Y position in DC to draw at
  1802. //    outWidth            UINT             width of dest rect
  1803. //    outHeight            UINT             height of dest rect
  1804. //    hPal                HPALETTE        palette to use in rendering the image.
  1805. //                                        if NULL, the system palette is used
  1806. //
  1807. //    modifies global error value, check with    ImgDLLGetLastError()
  1808. //
  1809. //    Return
  1810. //        FALSE on failure
  1811. //
  1812. ////////////////////////////////////////////////////////////
  1813.  
  1814. BOOL IMGEXP ImgDLLDrawRGB(HDC outDC,
  1815.                             BYTE *pRGB,
  1816.                             UINT inWidth,
  1817.                             UINT inHeight,
  1818.                             int xPos,
  1819.                             int yPos,
  1820.                             UINT outWidth,
  1821.                             UINT outHeight,
  1822.                             HPALETTE hPal);
  1823.  
  1824. ////////////////////////////////////////////////////////////
  1825. //
  1826. //    BOOL IMGEXP ImgDLLDrawRGB2(HDC outDC,
  1827. //                            BYTE *pRGB,
  1828. //                            UINT inWidth,
  1829. //                            UINT inHeight,
  1830. //                            int xPos,
  1831. //                            int yPos,
  1832. //                            UINT outWidth,
  1833. //                            UINT outHeight,
  1834. //                            HPALETTE hPal)
  1835. //    Purpose :
  1836. //        given an HBITMAP and an HDC, draw the image to the DC.
  1837. //    this uses StretchDIBBits. 
  1838. //    this is 20-30 % faster than ImgDLLDrawRGB(), but it can't
  1839. //    use a palette.
  1840. //
  1841. //    NOTE: using this function, an output size different than the
  1842. //    input size results in a scaled image. the scaling operation
  1843. //    produces images which are acceptable for most purposes, but
  1844. //    are not as good as you would get from using ResizeRGB.
  1845. //
  1846. //    this is different behavior than ImgDLLDrawRGB, which clips 
  1847. //    the image, if necessary.
  1848. //
  1849. //    Param                Type            Use
  1850. //    outHDC                HDC                device context to draw into
  1851. //    pRGB                BYTE *            RGB (24-bit) image
  1852. //    inWidth                UINT            width of RGB image
  1853. //    inHeight            UINT            height of RGB image
  1854. //    xPos                int                X position in DC to draw at
  1855. //    yPos                int                Y position in DC to draw at
  1856. //    outWidth            UINT             width of dest rect
  1857. //    outHeight            UINT             height of dest rect
  1858. //
  1859. //    modifies global error value, check with    ImgDLLGetLastError()
  1860. //
  1861. //    Return
  1862. //        NULL on failure
  1863. //
  1864. ////////////////////////////////////////////////////////////
  1865.  
  1866. BOOL IMGEXP ImgDLLDrawRGB2(HDC outDC,
  1867.                             BYTE *pRGB,
  1868.                             UINT inWidth,
  1869.                             UINT inHeight,
  1870.                             int xPos,
  1871.                             int yPos,
  1872.                             UINT outWidth,
  1873.                             UINT outHeight);
  1874.  
  1875. /////////////////////////////////////////////////////////////////////////////
  1876. //
  1877. //    BOOL IMGEXP ImgDLLDrawTransparentHBITMAP(HDC hdc, 
  1878. //                                         HBITMAP hBitmap, 
  1879. //                                         int xStart,
  1880. //                                         int yStart, 
  1881. //                                         COLORREF cTransparentColor)
  1882. //
  1883. //
  1884. //    Description:
  1885. //    Draws a bitmap with one color "transparent"
  1886. //    Code taken almost exactly from Microsoft Developer's Network
  1887. //    October 1995.
  1888. //
  1889. //    This does not work on printer DC's
  1890. //    
  1891. //    parameter            type            use
  1892. //    ---------            ----            -----
  1893. //    hdc                    HDC                handle to a DC to draw into
  1894. //    hBitmap                HBITMAP            handle to a BMP
  1895. //    xPos                int                xpos
  1896. //    ypos                int                ypos
  1897. //    cTransparentColor    COLORRREF        color to use as trasparent
  1898. //
  1899. //    return - TRUE on success
  1900. //
  1901. /////////////////////////////////////////////////////////////////////////////
  1902.  
  1903. BOOL IMGEXP ImgDLLDrawTransparentHBITMAP(HDC outDC, 
  1904.                                 HBITMAP hBmp,
  1905.                                 int xPos,
  1906.                                 int yPos,
  1907.                                 COLORREF cTransparentColor);
  1908.  
  1909. ////////////////////////////////////////////////////////////
  1910. //
  1911. //    BOOL IMGEXP ImgDLLDrawTranparentRGB(HDC outDC,
  1912. //                            BYTE *pRGB,
  1913. //                            UINT inWidth,
  1914. //                            UINT inHeight,
  1915. //                            int xPos,
  1916. //                            int yPos,
  1917. //                            COLORREF cTransparentColor)
  1918. //    Purpose :
  1919. //        given an RGB image and an HDC, draw the image to the DC with
  1920. //    one color transparent. this call wraps a call to ImgDLLRGBToHBITMAP 
  1921. //    and a call to ImgDLLDrawTransparentHBITMAP
  1922. //
  1923. //    Param                Type            Use
  1924. //    outHDC                HDC                device context to draw into
  1925. //    pRGB                BYTE *            RGB (24-bit) image
  1926. //    inWidth                UINT            width of RGB image
  1927. //    inHeight            UINT            height of RGB image
  1928. //    xPos                int                X position in DC to draw at
  1929. //    yPos                int                Y position in DC to draw at
  1930. //    cTransparentColor    COLORREF        color to use as trasparent
  1931. //
  1932. //    modifies global error value, check with    ImgDLLGetLastError()
  1933. //
  1934. //    Return
  1935. //        NULL on failure
  1936. //
  1937. ////////////////////////////////////////////////////////////
  1938.  
  1939. BOOL IMGEXP ImgDLLDrawTranparentRGB(HDC outDC,
  1940.                                         BYTE *pRGB,
  1941.                                         UINT inWidth,
  1942.                                         UINT inHeight,
  1943.                                         int xPos,
  1944.                                         int yPos,
  1945.                                         COLORREF cTransparentColor);
  1946.  
  1947. ////////////////////////////////////////////////////////////
  1948. //
  1949. //    HBITMAP IMGEXP ImgDLLLoadResourceBMP(HINSTANCE hInstance,
  1950. //                                    LPCSTR lpString, 
  1951. //                                    HPALETTE hInPalette);
  1952. //
  1953. //    use ImgDLLLoadResourceBMP, instead of CBitmap::LoadBitmap!
  1954. //
  1955. //    on 8-bit displays, LoadBitmap maps the bitmap to the 16-colors
  1956. //    of the standard Windows palette - this is no good. you don't even
  1957. //    get a chance to use a palette on the image because LoadBitmap mangles
  1958. //    the color info!! yuck!!
  1959. //
  1960. //    if you use this function, with a palette that represents a
  1961. //  spread of colors from the image, or even just a nice spread of
  1962. //    colors all across the spectrum, you'll get much better results.
  1963. //    trust me. 
  1964. //    
  1965. //    if you use a NULL palette, this function will use a 
  1966. //    set of colors from the system palette, which will give slightly
  1967. //    better results than LoadBitmap.
  1968. //
  1969. //    Param            type            use
  1970. //    hInstance        HINSTANCE        app instance to find a resource in
  1971. //    lpString        LPCSTR            resource name, or ID
  1972. //    hInPalette        HPALETTE        palette to map the bitmap through, may be NULL
  1973. //
  1974. //    returns an HBITMAP, else NULL
  1975. //
  1976. //    be sure to call DeleteObject(..) on this when you're done!
  1977. //
  1978. ////////////////////////////////////////////////////////////
  1979.  
  1980. HBITMAP IMGEXP ImgDLLLoadResourceBMP(HINSTANCE hInstance,
  1981.                                     LPCSTR lpString, 
  1982.                                     HPALETTE hInPalette);
  1983.  
  1984. ////////////////////////////////////////////////////////////
  1985. //
  1986. //    BOOL IMGEXP ImgDLLApplyMatrixToRGB(BYTE * rgbIn,
  1987. //                            BYTE * rgbOut,
  1988. //                            UINT widthPix,
  1989. //                            UINT height,
  1990. //                            BYTE channelMask,
  1991. //                            BOOL zero,
  1992. //                            BOOL bDoFeedback,
  1993. //                            double dLevel,
  1994. //                            double *pMatrix)
  1995. //
  1996. //    Purpose :
  1997. //        apply a convolution matrix to an RGB image.
  1998. //
  1999. //        buffers must be the same size!!!
  2000. //        rgbIn must not be the same as rgbOut !!!
  2001. //
  2002. //        the matrix is an array of _9_ doubles, arranged as :
  2003. //
  2004. //            0  1  2
  2005. //            3  4  5
  2006. //            6  7  8
  2007. ///
  2008. //            where "4" is the source pixel.
  2009. //
  2010. //        it is applied for pixel(x,y) as :
  2011. //
  2012. //            double tempSum = (
  2013. //            pMatrix[0] * pixel(x-1, y-1) +
  2014. //            pMatrix[1] * pixel(x,   y-1) +
  2015. //            pMatrix[2] * pixel(x+1, y-1) +
  2016. //            pMatrix[3] * pixel(x-1, y )  +
  2017. //            pMatrix[4] * pixel(x,   y )  +
  2018. //            pMatrix[5] * pixel(x+1, y )  +
  2019. //            pMatrix[6] * pixel(x-1, y+1) +
  2020. //            pMatrix[7] * pixel(x,   y+1) +
  2021. //            pMatrix[8] * pixel(x+1, y+1));        // step 1
  2022. //
  2023. //            tempSum = tempSum * dLevel;            // step 2
  2024. //            tempSum = min(tempSum, 255);        // step 3
  2025. //            tempSum = max(tempSum, 0);            // step 4
  2026. //
  2027. //            outval = (BYTE) tempSum;            // step 5
  2028. //
  2029. //    bDoFeedback
  2030. //        if the bDoFeedback options is TRUE, step 2 becomes :
  2031. //
  2032. //            tempSum = pixel(x,y) * (1.0 - dLevel) + (dLevel * tempSum);
  2033. //
  2034. //
  2035. //    channelMask
  2036. //        if the CHRED bit is set in channelMask, the matrix is
  2037. //        applied to all red pixels.
  2038. //    
  2039. //        if the CHGREEN bit is set in channelMask, the matrix is
  2040. //        applied to all green pixels.
  2041. //
  2042. //        if the CHBLUE bit is set in channelMask, the matrix is
  2043. //        applied to all blue pixels.
  2044. //
  2045. //    zero
  2046. //        if zero is TRUE, the input channels excluded by the channelMask
  2047. //        will have all values set to zero.
  2048. //        if zero is FALSE, the input channels excluded by the channelMask
  2049. //        will retain the values from the source image.
  2050. //
  2051. //
  2052. //    Param                Type            Use
  2053. //    rgbIn                BYTE *            24-bit RGB image data
  2054. //    rgbOut                BYTE *            24-bit RGB image data allocated by caller
  2055. //    widhtPix            UINT            width in pixels
  2056. //    height                UINT            height
  2057. //    channelMask            BYTE            controls which channels are to be modified
  2058. //                                        CHRED | CHGREEN | CHBLUE
  2059. //    zero                BOOL            controls channels excluded by channelMask
  2060. //    bDoFeedback            BOOL            controls arithmetic
  2061. //    dLevel                double            multiplier
  2062. //    pMatrix                double *        3 x 3 matrix to apply.
  2063. //
  2064. //    modifies global error value, check with    ImgDLLGetLastError()
  2065. //
  2066. //    Return
  2067. //        FALSE on failure
  2068. //
  2069. ////////////////////////////////////////////////////////////
  2070.  
  2071.  
  2072. BOOL IMGEXP ImgDLLApplyMatrixToRGB(BYTE * rgbIn,
  2073.                             BYTE * rgbOut,
  2074.                             UINT widthPix,
  2075.                             UINT height,
  2076.                             BYTE channelMask,
  2077.                             BOOL zero,
  2078.                             BOOL bDoFeedback,
  2079.                             double dLevel,
  2080.                             double *pMatrix);
  2081.  
  2082.  
  2083. ////////////////////////////////////////////////////////////
  2084. //
  2085. //    BOOL IMGEXP ImgDLLApplyConvolutionFilter(BYTE * rgbIn,
  2086. //                                                BYTE * rgbOut,
  2087. //                                                UINT widthPix,
  2088. //                                                UINT height,
  2089. //                                                UINT matrixCols,
  2090. //                                                UINT matrixRows,
  2091. //                                                double dLevel,
  2092. //                                                double *pMatrix)
  2093. //
  2094. //    Purpose :
  2095. //        apply a convolution filter/matrix to an RGB image.
  2096. //
  2097. //        buffers must be the same size!!!
  2098. //        rgbIn must not be the same as rgbOut !!!
  2099. //
  2100. //        the number of columns and the number of rows in the matrix
  2101. //        must both be odd!
  2102. //
  2103. //        it is applied as follows :
  2104. //
  2105. //            M = matrix ( 3x3, in this example)
  2106. //        
  2107. //                1  1  1
  2108. //            M = 1 -8  1            this is a sharpening matrix
  2109. //                1  1  1
  2110. //        
  2111. //            the matrix is centered on the current pixel. in this example, 
  2112. //            M[4] is the center of the matrix.
  2113. //
  2114. //            dLevel is a level 
  2115. //
  2116. //            P = pixels . since the matrix is centered on the current pixel,
  2117. //            P(x,y), the pixels used in this calculation will be :
  2118. //                P(x-1,y-1),    P(x, y-1),    P(x+1, y-1)
  2119. //                P(x-1,y),    P(x, y),    P(x+1, y)
  2120. //                P(x-1,y+1),    P(x, y+1),    P(x+1, y+1)
  2121. //
  2122. //            t = sum ( M[i] * P[i] )  [for all elements of the matrix]
  2123. //
  2124. //            outPixel = curPixel - (dLevel * t)
  2125. //
  2126. //        Matrix M in this example demonstrates the sharpening filter 
  2127. //        used by this library.
  2128. //
  2129. //        besides the ability to use matricies of arbitrary size, this function 
  2130. //        differs from ImgDLLApplyMatrixToRGB in the way the final caluclation 
  2131. //        is performed. 
  2132. //
  2133. //    Param                Type            Use
  2134. //    rgbIn                BYTE *            24-bit RGB image data
  2135. //    rgbOut                BYTE *            24-bit RGB image data allocated by caller
  2136. //    widhtPix            UINT            width of image in pixels
  2137. //    height                UINT            height of image
  2138. //    matrixCols            UINT            width of matrix, must be an odd number
  2139. //    matrixRows            UINT            height of matrix, must be an odd number
  2140. //    dLevel                double            multiplier
  2141. //    pMatrix                double *        matrix to apply . be sure you have 
  2142. //                                        matrixCols x matrixRows elements!!
  2143. //
  2144. //    modifies global error value, check with    ImgDLLGetLastError()
  2145. //
  2146. //    Return
  2147. //        FALSE on failure
  2148. //
  2149. ////////////////////////////////////////////////////////////
  2150.  
  2151. BOOL IMGEXP ImgDLLApplyConvolutionFilter(BYTE * rgbIn,
  2152.                                             BYTE * rgbOut,
  2153.                                             UINT widthPix,
  2154.                                             UINT height,
  2155.                                             UINT matrixCols,
  2156.                                             UINT matrixRows,
  2157.                                             double dLevel,
  2158.                                             double *pMatrix);
  2159.  
  2160. ////////////////////////////////////////////////////////////
  2161. //
  2162. //    BOOL IMGEXP ImgDLLApplyLUTToRGB(BYTE *rgbBuf,
  2163. //                                   UINT widthPix,
  2164. //                                   UINT height,
  2165. //                                   BYTE channelMask,
  2166. //                                   BYTE *pLUT)
  2167. //
  2168. //    Purpose :
  2169. //        Apply a Look Up Table (LUT) to an RGB image.
  2170. //    
  2171. //    For each channel in each pixel the following function is
  2172. //    performed :
  2173. //        
  2174. //        v = Val[pixel][channel]
  2175. //        v' = LUT[v]
  2176. //        v = v'
  2177. //
  2178. //    Param                Type            Use
  2179. //    rgbBuf                BYTE *            buffer to apply LUT to
  2180. //    widthPix            UINT            width
  2181. //    height                UINT            height
  2182. //    channelMask            BYTE            control which channels are modified
  2183. //                                        CHRED | CHGREEN | CHBLUE
  2184. //    pLUT                BYTE            array of 256 BYTE values (0...255)
  2185. //
  2186. //    modifies global error value, check with    ImgDLLGetLastError()
  2187. //
  2188. //    Return
  2189. //        FALSE on failure
  2190. //
  2191. ////////////////////////////////////////////////////////////
  2192.  
  2193. BOOL IMGEXP ImgDLLApplyLUTToRGB(BYTE *rgbBuf,
  2194.                                    UINT widthPix,
  2195.                                    UINT height,
  2196.                                    BYTE channelMask,
  2197.                                    BYTE *pLUT);
  2198.  
  2199.  
  2200. ////////////////////////////////////////////////////////////
  2201. //
  2202. //    BOOL IMGEXP ImgDLLHistogramEqualizeRGB(BYTE *inBuf, 
  2203. //                                UINT widthPix, 
  2204. //                                UINT height,
  2205. //                                UINT loThresh,
  2206. //                                UINT hiThresh,
  2207. //                                BYTE channelMask);
  2208. //
  2209. //
  2210. //    Purpose :
  2211. //        Perform histogram equalization on an image.
  2212. //
  2213. //    Param                Type            Use
  2214. //    inBuf                BYTE *            buffer
  2215. //    widthPix            UINT            width, in pixels
  2216. //    height                UINT            height 
  2217. //    loThresh            UINT            0..255 low limit on candidate pixel values
  2218. //    hiThresh            UINT            0..255 hi limit on candidate pixel values. 
  2219. //                                        must be < loThresh
  2220. //    channelMask            BYTE            control which channels are modified
  2221. //                                        CHRED | CHGREEN | CHBLUE
  2222. //
  2223. //    modifies global error value, check with    ImgDLLGetLastError()
  2224. //
  2225. //    Return
  2226. //        TRUE on success
  2227. //
  2228. ////////////////////////////////////////////////////////////
  2229.  
  2230. BOOL IMGEXP ImgDLLHistogramEqualizeRGB(BYTE *inBuf, 
  2231.                                 UINT widthPix, 
  2232.                                 UINT height,
  2233.                                 UINT loThresh,
  2234.                                 UINT hiThresh,
  2235.                                 BYTE channelMask);
  2236.  
  2237.  
  2238. ////////////////////////////////////////////////////////////
  2239. //
  2240. //    BOOL ImgDLLGetBrightnessHistogram(BYTE *inBuf,
  2241. //                                    UINT widthPix,
  2242. //                                    UINT height,
  2243. //                                    int *pHisto);
  2244. //
  2245. //    Purpose :
  2246. //        Calculate the brightness/luminance histogram for an image.
  2247. //    For 0..255, every pixel with a calculated luminance of "b" will
  2248. //    increase the value of pHisto[b].
  2249. //
  2250. //    Param                Type            Use
  2251. //    inBuf                BYTE *            buffer
  2252. //    widthPix            UINT            width, in pixels
  2253. //    height                UINT            height 
  2254. //    pHisto                int *            array of 256 ints
  2255. //
  2256. //    modifies global error value, check with    ImgDLLGetLastError()
  2257. //
  2258. //    Return
  2259. //        TRUE on success
  2260. //
  2261. ////////////////////////////////////////////////////////////
  2262.  
  2263. BOOL IMGEXP ImgDLLGetBrightnessHistogram(BYTE *inBuf,
  2264.                                 UINT widthPix,
  2265.                                 UINT height,
  2266.                                 int *pHisto);
  2267.  
  2268. ////////////////////////////////////////////////////////////
  2269. //
  2270. //    BOOL IMGEXP ImgDLLGetChannelHistogram(BYTE *inBuf,
  2271. //                                            UINT widthPix,
  2272. //                                            UINT height,
  2273. //                                            BYTE chMask,
  2274. //                                            int *pHisto);
  2275. //
  2276. //    Purpose :
  2277. //        Calculate the histogram for a single channel (R,G or B) in 
  2278. //    an RGB image.
  2279. //    Every pixel in the image with a value of "b" in the specified
  2280. //    channel will increase the value of pHisto[b] by one.
  2281. //
  2282. //    Param                Type            Use
  2283. //    inBuf                BYTE *            buffer
  2284. //    widthPix            UINT            width, in pixels
  2285. //    height                UINT            height 
  2286. //    chMask                BYTE            _one of_ CHRED, CHGREEN, CHBLUE
  2287. //    pHisto                int *            array of 256 ints
  2288. //
  2289. //    modifies global error value, check with    ImgDLLGetLastError()
  2290. //
  2291. //    Return
  2292. //        TRUE on success
  2293. //
  2294. ////////////////////////////////////////////////////////////
  2295.  
  2296. BOOL IMGEXP ImgDLLGetChannelHistogram(BYTE *inBuf,
  2297.                                         UINT widthPix,
  2298.                                         UINT height,
  2299.                                         BYTE chMask,
  2300.                                         int *pHisto);
  2301.  
  2302. ////////////////////////////////////////////////////////////
  2303. //
  2304. //    HGLOBAL IMGEXP ImgDLLRotateRGB(BYTE *inBuf, 
  2305. //                                UINT widthPix, 
  2306. //                                UINT height,
  2307. //                                double radians,
  2308. //                                COLORREF backColor,
  2309. //                                UINT * outWidth,
  2310. //                                UINT *outHeight);
  2311. //
  2312. //
  2313. //    Purpose :
  2314. //        Rotate an RGB image by a number of radians.
  2315. //
  2316. //    Param                Type            Use
  2317. //    inBuf                BYTE *            input image
  2318. //    widthPix            UINT            width, in pixels
  2319. //    height                UINT            height 
  2320. //    radians                double            0..2pi radians to rotate
  2321. //    backColor            COLORREF        color to draw where there is no image
  2322. //    outWidth            UINT *            output width
  2323. //    outHeight            UINT *            output height
  2324. //
  2325. //    modifies global error value, check with    ImgDLLGetLastError()
  2326. //
  2327. //    Return
  2328. //        HGLOBAL to a new image, else NULL on failure
  2329. //
  2330. ////////////////////////////////////////////////////////////
  2331.  
  2332. HGLOBAL IMGEXP ImgDLLRotateRGB(BYTE *inBuf, 
  2333.                                 UINT widthPix, 
  2334.                                 UINT height,
  2335.                                 double radians,
  2336.                                 COLORREF backColor,
  2337.                                 UINT * outWidth,
  2338.                                 UINT *outHeight);
  2339.  
  2340. ////////////////////////////////////////////////////////////
  2341. //
  2342. //    BOOL IMGEXP ImgDLLQuickRotateRGB(BYTE *inBuf, 
  2343. //                                            UINT widthPix, 
  2344. //                                            UINT height,
  2345. //                                            int rotationType)
  2346. //
  2347. //
  2348. //    Purpose :
  2349. //        Rotate an RGB image 90, 180 or 270 degrees.
  2350. //    This rotates the image in-place.
  2351. //
  2352. //    Param                Type            Use
  2353. //    inBuf                BYTE *            input image
  2354. //    widthPix            UINT            width, in pixels
  2355. //    height                UINT            height 
  2356. //    rotationType        int                rotation type : 
  2357. //                                        0 - 90 degrees cw
  2358. //                                        1 - 180 deg
  2359. //                                        2 - 270 deg cw
  2360. //
  2361. //    modifies global error value, check with    ImgDLLGetLastError()
  2362. //
  2363. //    Return
  2364. //        BOOL - TRUE on success
  2365. //
  2366. ////////////////////////////////////////////////////////////
  2367.  
  2368. BOOL IMGEXP ImgDLLQuickRotateRGB(BYTE *inBuf, 
  2369.                                             UINT widthPix, 
  2370.                                             UINT height,
  2371.                                             int rotationType);
  2372.  
  2373. ////////////////////////////////////////////////////////////
  2374. //
  2375. //    HGLOBAL IMGEXP ImgDLLCropRGB(BYTE *inBuf,
  2376. //                           UINT uInWidthPix,
  2377. //                           UINT uInHeight,
  2378. //                           UINT uLeft,
  2379. //                           UINT uTop,
  2380. //                           UINT uRight,
  2381. //                           UINT uBottom)
  2382. //    Purpose :
  2383. //        Crop an image to the rectangle specified.
  2384. //
  2385. //    Param                Type            Use
  2386. //    inBuf                BYTE *            input image
  2387. //    uInWidthPix            UINT            width, in pixels
  2388. //    uInHeight            UINT            height 
  2389. //    uLeft                UINT            left edge of crop rect
  2390. //    uTop                UINT            top edge of crop rect
  2391. //    uRight                UINT            right edge...
  2392. //    uBottom                UINT            bottom edge
  2393. //
  2394. //    uTop <= uBottom
  2395. //    uLeft <= uRight
  2396. //
  2397. //    uRight - uLeft < uInWidthPix
  2398. //    uBottom - uTop < uInHeight
  2399. //
  2400. //    modifies global error value, check with    ImgDLLGetLastError()
  2401. //
  2402. //    Return
  2403. //        HGLOBAL to a new image, else NULL on failure
  2404. //
  2405. ////////////////////////////////////////////////////////////
  2406.  
  2407. HGLOBAL IMGEXP ImgDLLCropRGB(BYTE *inBuf,
  2408.                            UINT uInWidthPix,
  2409.                            UINT uInHeight,
  2410.                            UINT uLeft,
  2411.                            UINT uTop,
  2412.                            UINT uRight,
  2413.                            UINT uBottom);
  2414.  
  2415. ////////////////////////////////////////////////////////////
  2416. //
  2417. //    HGLOBAL IMGEXP ImgDLLZoomRGB(BYTE *inBuf,
  2418. //                           UINT uInWidthPix,
  2419. //                           UINT uInHeight,
  2420. //                           UINT uLeft,
  2421. //                           UINT uTop,
  2422. //                           UINT uRight,
  2423. //                           UINT uBottom,
  2424. //                           UINT uOutWidthPix,
  2425. //                           UINT uOutHeight)
  2426. //    Purpose :
  2427. //        Zoom into an image. Performed as a crop to the rectangle
  2428. //    specified, then a resize to the output dimensions. This actually
  2429. //    uses ImgDLLCropRGB and then ImgDLLResizeRGB.
  2430. //
  2431. //    Param                Type            Use
  2432. //    inBuf                BYTE *            input image
  2433. //    uInWidthPix            UINT            width, in pixels
  2434. //    uInHeight            UINT            height 
  2435. //    uLeft                UINT            left edge of crop rect
  2436. //    uTop                UINT            top edge of crop rect
  2437. //    uRight                UINT            right edge...
  2438. //    uBottom                UINT            bottom edge
  2439. //    uOutWidthPix        UINT            width of output image (may be > uInWidthPix)
  2440. //    uOutHeight            UINT            height of output image (may be > uInHeight)
  2441. //
  2442. //    uTop <= uBottom
  2443. //    uLeft <= uRight
  2444. //
  2445. //    uRight - uLeft < uInWidthPix
  2446. //    uBottom - uTop < uInHeight
  2447. //
  2448. //    modifies global error value, check with    ImgDLLGetLastError()
  2449. //
  2450. //    Return
  2451. //        HGLOBAL to a new image, else NULL on failure
  2452. //
  2453. ////////////////////////////////////////////////////////////
  2454.  
  2455. HGLOBAL IMGEXP ImgDLLZoomRGB(BYTE *inBuf,
  2456.                            UINT uInWidthPix,
  2457.                            UINT uInHeight,
  2458.                            UINT uLeft,
  2459.                            UINT uTop,
  2460.                            UINT uRight,
  2461.                            UINT uBottom,
  2462.                            UINT uOutWidthPix,
  2463.                            UINT uOutHeight);
  2464.  
  2465. ////////////////////////////////////////////////////////////
  2466. //
  2467. //    BOOL IMGEXP ImgDLLOverlayRGB(BYTE *pImage1,
  2468. //                           UINT uImage1Width,
  2469. //                           UINT uImage1Height,
  2470. //                           BYTE *pImage2,
  2471. //                           UINT uImage2Width,
  2472. //                           UINT uImage2Height,
  2473. //                           int iXPos,
  2474. //                           int iYPos,
  2475. //                           double opacity)
  2476. //    Purpose :
  2477. //        Overlay one image on another, using variable opacity.
  2478. //
  2479. //    pImage1 must point to an RGB image that is larger or
  2480. //    equal in size to the image in pImage2.
  2481. //
  2482. //    Param                Type        Use
  2483. //    pImage1                BYTE *        larger image to receive the overlay
  2484. //  uImage1Width        UINT        width of pImage1    
  2485. //  uImage1Height        UINT        height of pImage1
  2486. //    pImage2                BYTE *        smaller image to be overlayed
  2487. //  uImage2Width        UINT        width of pImage2
  2488. //  uImage2Height        UINT        height of pImage2
  2489. //  iXPos                int        x position on pImage1 where overlay will start
  2490. //  iYPos                int        y position on pImage1 where overlay will start
  2491. //    opacity                double        overlay image opacity (0...1 . 1 is opaque)
  2492. //
  2493. //    modifies global error value, check with    ImgDLLGetLastError()
  2494. //
  2495. //    Return
  2496. //        FALSE on failure
  2497. //
  2498. ////////////////////////////////////////////////////////////
  2499.  
  2500. BOOL IMGEXP ImgDLLOverlayRGB(BYTE *pImage1,
  2501.                            UINT uImage1Width,
  2502.                            UINT uImage1Height,
  2503.                            BYTE *pImage2,
  2504.                            UINT uImage2Width,
  2505.                            UINT uImage2Height,
  2506.                            int iXPos,
  2507.                            int iYPos,
  2508.                            double opacity);
  2509.  
  2510. ////////////////////////////////////////////////////////////
  2511. //
  2512. //    BOOL IMGEXP ImgDLLOverlayRGBTransparentBYTE *pImage1,
  2513. //                           UINT uImage1Width,
  2514. //                           UINT uImage1Height,
  2515. //                           BYTE *pImage2,
  2516. //                           UINT uImage2Width,
  2517. //                           UINT uImage2Height,
  2518. //                           int  iXPos,
  2519. //                           int  iYPos,
  2520. //                           double opacity,
  2521. //                            COLORREF transColor)
  2522. //
  2523. //    Purpose :
  2524. //        Overlay one image on another, using variable opacity and
  2525. //    one transparent color.
  2526. //
  2527. //    transColor specifies a color in image2 that is to be considered
  2528. //    transparent - image1 will show through image2 where the color of
  2529. //    image 2 is transColor.
  2530. //
  2531. //    pImage1 must point to an RGB image that is larger or
  2532. //    equal in size to the image in pImage2.
  2533. //
  2534. //    Param                Type        Use
  2535. //    pImage1                BYTE *        larger image to receive the overlay
  2536. //  uImage1Width        UINT        width of pImage1    
  2537. //  uImage1Height        UINT        height of pImage1
  2538. //    pImage2                BYTE *        smaller image to be overlayed
  2539. //  uImage2Width        UINT        width of pImage2
  2540. //  uImage2Height        UINT        height of pImage2
  2541. //  iXPos                int         x position on pImage1 where overlay will start
  2542. //  iYPos                int         y position on pImage1 where overlay will start
  2543. //    opacity                double        overlay image opacity (0.0 - 1.0 1 is opaque)
  2544. //    transColor            COLORREF    color in image2 to be considered trasnparent
  2545. //
  2546. //
  2547. //    modifies global error value, check with    ImgDLLGetLastError()
  2548. //
  2549. //    Return
  2550. //        FALSE on failure
  2551. //
  2552. ////////////////////////////////////////////////////////////
  2553.  
  2554. BOOL IMGEXP ImgDLLOverlayRGBTransparent(BYTE *pImage1,
  2555.                            UINT uImage1Width,
  2556.                            UINT uImage1Height,
  2557.                            BYTE *pImage2,
  2558.                            UINT uImage2Width,
  2559.                            UINT uImage2Height,
  2560.                            int  iXPos,
  2561.                            int  iYPos,
  2562.                            double opacity,
  2563.                            COLORREF clr);
  2564.  
  2565. ////////////////////////////////////////////////////////////
  2566. //
  2567. //    UINT IMGEXP ImgDLLCountRGBColors(BYTE *inBuf,
  2568. //                        UINT widthPix,
  2569. //                        UINT height,
  2570. //                        BOOL fast)
  2571. //
  2572. //    Purpose :
  2573. //        Count colors used in RGB image
  2574. //
  2575. //    Param                Type        Use
  2576. //    InBuf                BYTE *        input image
  2577. //  widthPix            UINT        width of image
  2578. //  height                UINT        height of image
  2579. //    fast                BOOL        if TRUE, this uses 1 MB of memory and runs
  2580. //                                    about 18% faster than if FALSE. if FALSE,
  2581. //                                    this uses 512 K of memory.
  2582. //
  2583. //    modifies global error value, check with    ImgDLLGetLastError()
  2584. //
  2585. //    Return
  2586. //        FALSE on failure
  2587. //
  2588. ////////////////////////////////////////////////////////////
  2589.  
  2590. UINT IMGEXP ImgDLLCountRGBColors(BYTE *inBuf,
  2591.                         UINT widthPix,
  2592.                         UINT height,
  2593.                         BOOL fast);
  2594.  
  2595.  
  2596. ////////////////////////////////////////////////////////////
  2597. //
  2598. //    BOOL IMGEXP ImgDLLDrawTextOnRGB(BYTE *pRGB,
  2599. //                            UINT width,
  2600. //                            UINT height,
  2601. //                            const char *drawText,
  2602. //                            const char *fontName,
  2603. //                            UINT fontPixels,
  2604. //                            int xpos,
  2605. //                            int ypos,
  2606. //                            COLORREF textColor)
  2607. //
  2608. //    Purpose :
  2609. //        draw text on an RGB image.
  2610. //
  2611. //
  2612. //    Param            Type            Use
  2613. //    pRGB            BYTE *            ptr to your image data
  2614. //    width            UINT            image width, in pixels
  2615. //    height            UINT            image height
  2616. //    drawText        const char *    text to draw
  2617. //    fontName        const char *    name of font to use
  2618. //    fontPixels        UINT            max height of text, in pixels
  2619. //    xpos            int                x position
  2620. //    ypos            int                y position
  2621. //    textColor        COLORREF        text color
  2622. //
  2623. //    modifies global error value, check with    ImgDLLGetLastError()
  2624. //
  2625. //    Return
  2626. //        TRUE on success, else FALSE
  2627. //
  2628. ////////////////////////////////////////////////////////////
  2629.  
  2630. BOOL IMGEXP ImgDLLDrawTextOnRGB(BYTE *pRGB,
  2631.                             UINT width,
  2632.                             UINT height,
  2633.                             const char *drawText,
  2634.                             const char *fontName,
  2635.                             UINT fontPixels,
  2636.                             int xpos,
  2637.                             int ypos,
  2638.                             COLORREF textColor);
  2639.  
  2640. ////////////////////////////////////////////////////////////
  2641. //
  2642. //    BOOL IMGEXP ImgDLLDrawTextOnRGB2(BYTE *pRGB,
  2643. //                            UINT width,
  2644. //                            UINT height,
  2645. //                            const char *drawText,
  2646. //                            const LOGFONT *pLogFont,
  2647. //                            int xpos,
  2648. //                            int ypos,
  2649. //                            COLORREF textColor)
  2650. //
  2651. //    Purpose :
  2652. //        draw text on an RGB image.
  2653. //
  2654. //
  2655. //    Param            Type            Use
  2656. //    pRGB            BYTE *            ptr to your image data
  2657. //    width            UINT            image width, in pixels
  2658. //    height            UINT            image height
  2659. //    drawText        const char *    text to draw
  2660. // pLogFont        const LOGFONT *    use this font - caller must initialize this !
  2661. //    xpos            int                x position
  2662. //    ypos            int                y position
  2663. //    textColor        COLORREF        text color
  2664. //
  2665. //    modifies global error value, check with    ImgDLLGetLastError()
  2666. //
  2667. //    Return
  2668. //        TRUE on success, else FALSE
  2669. //
  2670. ////////////////////////////////////////////////////////////
  2671.  
  2672. BOOL IMGEXP ImgDLLDrawTextOnRGB2(BYTE *pRGB,
  2673.                             UINT width,
  2674.                             UINT height,
  2675.                             const char *drawText,
  2676.                             const LOGFONT *pLogFont,
  2677.                             int xpos,
  2678.                             int ypos,
  2679.                             COLORREF textColor);
  2680.  
  2681. ////////////////////////////////////////////////////////////
  2682. //
  2683. //    void IMGEXP ImgDLLColorSubRGB(BYTE *image,
  2684. //                       UINT w,
  2685. //                       UINT h,
  2686. //                       COLORREF oldColor,
  2687. //                       COLORREF newColor)
  2688. //
  2689. //    Purpose :
  2690. //        replace all pixels of a given color with a new color
  2691. //
  2692. //    Param            Type            Use
  2693. //    image            BYTE *            RGB image
  2694. //    w                UINT            width
  2695. //    h                UINT            height
  2696. //    oldColor        COLORREF        color to look for
  2697. //    newColor        COLORREF        color to replace it with
  2698. //    
  2699. //
  2700. //    Return
  2701. //        none
  2702. //
  2703. ////////////////////////////////////////////////////////////
  2704. void IMGEXP ImgDLLColorSubRGB(BYTE *image,
  2705.                        UINT w,
  2706.                        UINT h,
  2707.                        COLORREF oldColor,
  2708.                        COLORREF newColor);
  2709.  
  2710. ////////////////////////////////////////////////////////////
  2711. //
  2712. //    HGLOBAL IMGEXP ImgDLLReadRGBFromPNG(const char * fileName,
  2713. //                             UINT *width,
  2714. //                             UINT *height)
  2715. //
  2716. //
  2717. //    Purpose :
  2718. //        Read a PNG file to a buffer of RGB bytes. all files types
  2719. //    are converted to 24-bit RGB images!!
  2720. //
  2721. //        screen gamma defaults to 2.9 . this can (and should) be changed
  2722. //    to your own monitor's gamma value by using ImgDLLPNGSetScreenGamma.
  2723. //
  2724. //        background color for alpha blending channel is set by using
  2725. //    ImgDLLPNGSetDefBackground.
  2726. //
  2727. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  2728. //
  2729. //    Param                Type            Use
  2730. //    fileName            const char *    path to open for reading
  2731. //    uWidth                UINT*            width, in pixels
  2732. //    uHeight                UINT*            height, in pixels
  2733. //
  2734. //    modifies global error value, check with    ImgDLLGetLastError()
  2735. //
  2736. //    Return
  2737. //        HGLOBAL . 
  2738. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  2739. //        Caller is responsible for calling GlobalFree on this buffer!
  2740. //
  2741. ////////////////////////////////////////////////////////////
  2742.  
  2743. HGLOBAL IMGEXP ImgDLLReadRGBFromPNG(const char *fileName,
  2744.                                         UINT *width, 
  2745.                                         UINT *height);
  2746.  
  2747. ////////////////////////////////////////////////////////////
  2748. //
  2749. //    double IMGEXP ImgDLLPNGSetScreenGamma(double screenGamma)
  2750. //
  2751. //    Purpose :
  2752. //        Set the screen gamma value for PNG reads and writes
  2753. //
  2754. //    Param            Type            Use
  2755. //    screenGamma        double            value to set as gamma. 
  2756. //
  2757. //    Return
  2758. //        last PNG gamma value
  2759. //
  2760. ////////////////////////////////////////////////////////////
  2761.  
  2762. double IMGEXP ImgDLLPNGSetScreenGamma(double screenGamma);
  2763.  
  2764. ////////////////////////////////////////////////////////////
  2765. //
  2766. //    void IMGEXP ImgDLLPNGSetDefBackground(BYTE palIndex,
  2767. //                                         UINT red,
  2768. //                                         UINT green,
  2769. //                                         UINT blue,
  2770. //                                         UINT gray)
  2771. //
  2772. //    Purpose :
  2773. //        Set the background colors to be used in blending the
  2774. //    alpha channel from PNG images that have one. This is used
  2775. //    for both reading and writing of PNG images - if the input image
  2776. //    uses an alpha channel but has no background specified, this
  2777. //    value is used. When writing a file, this value is written
  2778. //    as the default background.
  2779. //
  2780. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  2781. //
  2782. //    Param            Type            Use
  2783. //    palIndex        BYTE            palIndex to use for background
  2784. //                                    (if you know the incoming image has a 
  2785. //                                    certain palette)
  2786. //    red                UINT            red component of RGB background value
  2787. //    green            UINT            green component of RGB background value
  2788. //    blue            UINT            blue component of RGB background value
  2789. //    gray            UINT            gray value to be used for grayscale images
  2790. //
  2791. //    Return
  2792. //        none
  2793. //
  2794. ////////////////////////////////////////////////////////////
  2795.  
  2796. void IMGEXP ImgDLLPNGSetDefBackground(BYTE palIndex,
  2797.                                          UINT red,
  2798.                                          UINT green,
  2799.                                          UINT blue,
  2800.                                          UINT gray);
  2801.  
  2802.  
  2803. ////////////////////////////////////////////////////////////
  2804. //
  2805. //    BOOL IMGDLLEXP ImgDLLSaveToPNG(const char *imageFileName, 
  2806. //                              BYTE *image, 
  2807. //                              UINT inWidthPix, 
  2808. //                              UINT inHeight, 
  2809. //                              UINT inWidthBytes,
  2810. //                              UINT bitDepth,
  2811. //                              UINT colors,
  2812. //                              RGBQUAD * inPalette, 
  2813. //                              UINT colorType,
  2814. //                              double gammaVal,
  2815. //                              UINT filterMask,
  2816. //                              UINT interlaceType)
  2817. //
  2818. //
  2819. //    Purpose :
  2820. //        Save a buffer to a PNG file. 
  2821. //
  2822. //        This routine can take a large variety of input image
  2823. //    formats, not just packed RGB!. There is not much error checking 
  2824. //    done on the input data. Be sure that what you are passing is in the
  2825. //    format you say it is!! 
  2826. //
  2827. //    Writes any text fields added with ImgDLLAddPNGText
  2828. //
  2829. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  2830. //
  2831. //    Param            Type            Use
  2832. //    imageFileName    const char *    file to write
  2833. //    image            BYTE *            ptr to your image data
  2834. //    inWidthPix        UINT            image width, in pixels
  2835. //    inHeight        UINT            image height
  2836. //    inWidthBytes    UINT            width of an image row, in BYTEs
  2837. //    bitDepth        UINT            1, 2, 4, 8, or 16 bits/channel
  2838. //    colors            UINT            number of colors in palette
  2839. //
  2840. //    inPalette        RGBQUAD *        palette entries. there must be at least
  2841. //                                    as many RGBQUADs as specified by "colors".
  2842. //                                    if your image does not use a palette, pass
  2843. //                                    NULL for this parameter.
  2844. //
  2845. //    colorType        UINT            this tells the PNG writer which format the
  2846. //                                    input image is in, see PNG_COLOR_* definitions
  2847. //
  2848. //    gammaVal        double            if you know the display gamma of the device this 
  2849. //                                    image was created on, pass a value equal 
  2850. //                                    to 1 / display_gamma. according to the PNG docs,
  2851. //                                    a value of .45 is acceptable for most PCs
  2852. //
  2853. //    filterMask        UINT            filter to apply to the image. as of LibPng-0.96,
  2854. //                                    the only valid value is 0.
  2855. //
  2856. //    interlaceType    UINT            see PNG_INTERLACE_* definitions
  2857. //
  2858. //    title            char *            optional text to write under key "Title"
  2859. //    description        char *            optional text to write under key "Description"
  2860. //
  2861. //    modifies global error value, check with    ImgDLLGetLastError()
  2862. //
  2863. //    Return
  2864. //        TRUE on success, else FALSE
  2865. //
  2866. ////////////////////////////////////////////////////////////
  2867.  
  2868. BOOL IMGEXP ImgDLLSaveToPNG(const char *imageFileName, 
  2869.                               BYTE *image, 
  2870.                               UINT inWidthPix, 
  2871.                               UINT inHeight, 
  2872.                               UINT inWidthBytes,
  2873.                               UINT bitDepth,
  2874.                               UINT colors,
  2875.                               RGBQUAD * inPalette, 
  2876.                               UINT colorType,
  2877.                               double gammaVal,
  2878.                               UINT filterMask,
  2879.                               UINT interlaceType);
  2880.  
  2881. ////////////////////////////////////////////////////////////
  2882. //
  2883. //    BOOL IMGEXP ImgDLLSaveRGB24ToPNGRGB(const char *imageFileName, 
  2884. //                              BYTE *image, 
  2885. //                              UINT inWidthPix, 
  2886. //                              UINT inHeight, 
  2887. //                              double gammaVal)
  2888. //
  2889. //    Purpose :
  2890. //        Save an RGB24 buffer to a PNG-RGB24 file. 
  2891. //
  2892. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  2893. //
  2894. //    Writes any text fields added with ImgDLLAddPNGText
  2895. //
  2896. //    Param            Type            Use
  2897. //    imageFileName    const char *    file to write
  2898. //    image            BYTE *            ptr to your image data
  2899. //    inWidthPix        UINT            image width, in pixels
  2900. //    inHeight        UINT            image height
  2901. //    gammaVal        double            if you know the display gamma of the device this 
  2902. //                                    image was created on, pass a value equal 
  2903. //                                    to 1 / display_gamma. according to the PNG docs,
  2904. //                                    a value of .45 is acceptable for most PCs
  2905. //
  2906. //    modifies global error value, check with    ImgDLLGetLastError()
  2907. //
  2908. //    Return
  2909. //        TRUE on success, else FALSE
  2910. //
  2911. ////////////////////////////////////////////////////////////
  2912.  
  2913. BOOL IMGEXP ImgDLLSaveRGB24ToPNGRGB(const char *imageFileName, 
  2914.                               BYTE *image, 
  2915.                               UINT inWidthPix, 
  2916.                               UINT inHeight, 
  2917.                               double gammaVal);
  2918.  
  2919. ////////////////////////////////////////////////////////////
  2920. //
  2921. //    BOOL IMGEXP ImgDLLSave8BitToPNG8Bit(const char *imageFileName, 
  2922. //                              BYTE *image, 
  2923. //                              UINT inWidthPix, 
  2924. //                              UINT inHeight, 
  2925. //                              UINT colors,
  2926. //                              RGBQUAD * inPalette,
  2927. //                              double gammaVal)
  2928. //
  2929. //    Purpose :
  2930. //        Save an RGB24 buffer to a PNG-RGB24 file. 
  2931. //
  2932. //    Writes any text fields added with ImgDLLAddPNGText
  2933. //
  2934. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  2935. //
  2936. //    Param            Type            Use
  2937. //    imageFileName    const char *    file to write
  2938. //    image            BYTE *            ptr to your image data
  2939. //    inWidthPix        UINT            image width, in pixels
  2940. //    inHeight        UINT            image height
  2941. //    colors            UINT            number of colors in palette
  2942. //    inPalette        RGBQUAD            palette
  2943. //    gammaVal        double            if you know the display gamma of the device this 
  2944. //                                    image was created on, pass a value equal 
  2945. //                                    to 1 / display_gamma. according to the PNG docs,
  2946. //                                    a value of .45 is acceptable for most PCs
  2947. //
  2948. //    modifies global error value, check with    ImgDLLGetLastError()
  2949. //
  2950. //    Return
  2951. //        TRUE on success, else FALSE
  2952. //
  2953. ////////////////////////////////////////////////////////////
  2954.  
  2955. BOOL IMGEXP ImgDLLSave8BitToPNG8Bit(const char *imageFileName, 
  2956.                                       BYTE *image, 
  2957.                                       UINT inWidthPix, 
  2958.                                       UINT inHeight, 
  2959.                                       UINT colors,
  2960.                                       RGBQUAD * inPalette,
  2961.                                       double gammaVal);
  2962.  
  2963. ////////////////////////////////////////////////////////////
  2964. //
  2965. //    HGLOBAL IMGEXP ImgDLLGetPNGKey(UINT index);
  2966. //
  2967. //    Purpose :
  2968. //        return a buffer containing the key of one of the PNG text
  2969. //    fields.
  2970. //
  2971. //    a PNG file may contain any number text fields. Each of these fields
  2972. //    consists of a key and the text. These strings can be any length.
  2973. //    When ImgDLL reads a PNG file, it stores these strings in the 
  2974. //    ImgDLL PNG text buffer. These strings remain valid until the next 
  2975. //    PNG file is read or ImgDLLClearPNGText is called. 
  2976. //
  2977. //    To find the number of strings read from the last PNG file, use
  2978. //    ImgDLLGetPNGTextCount.
  2979. //
  2980. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  2981. //
  2982. //    Param            Type            Use
  2983. //    index            UINT            index of string you'd like to fetch
  2984. //
  2985. //    modifies global error value, check with    ImgDLLGetLastError()
  2986. //
  2987. //    Return
  2988. //        HGLOBAL to a zero-terminated string, else NULL on error
  2989. //
  2990. ////////////////////////////////////////////////////////////
  2991.  
  2992. HGLOBAL IMGEXP ImgDLLGetPNGKey(UINT index);
  2993.  
  2994. ////////////////////////////////////////////////////////////
  2995. //
  2996. //    HGLOBAL IMGEXP ImgDLLGetPNGText(UINT index);
  2997. //
  2998. //    Purpose :
  2999. //        return a buffer containing the text of one of the PNG text
  3000. //    fields.
  3001. //
  3002. //    a PNG file may contain any number text fields. Each of these fields
  3003. //    consists of a key and the text. These strings can be any length.
  3004. //    When ImgDLL reads a PNG file, it stores these strings in the 
  3005. //    ImgDLL PNG text buffer. These strings remain valid until the next 
  3006. //    PNG file is read or ImgDLLClearPNGText is called. 
  3007. //
  3008. //    To find the number of strings read from the last PNG file, use
  3009. //    ImgDLLGetPNGTextCount.
  3010. //
  3011. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  3012. //
  3013. //    Param            Type            Use
  3014. //    index            UINT            index of string you'd like to fetch
  3015. //
  3016. //    modifies global error value, check with    ImgDLLGetLastError()
  3017. //
  3018. //    Return
  3019. //        HGLOBAL to a zero-terminated string, else NULL on error
  3020. //
  3021. ////////////////////////////////////////////////////////////
  3022.  
  3023. HGLOBAL IMGEXP ImgDLLGetPNGText(UINT index);
  3024.  
  3025. ////////////////////////////////////////////////////////////
  3026. //
  3027. //    void IMGEXP ImgDLLClearPNGText();
  3028. //
  3029. //    Purpose :
  3030. //        clear the stored PNG text fields, both input and output. 
  3031. //    when you read a PNG file, the stored text remains in memory 
  3032. //    until you read a new PNG file, or you explicitly clear it with 
  3033. //    this call.
  3034. //
  3035. //    see ImgDLLAddPNGText for a brief example
  3036. //
  3037. //    Param            Type            Use
  3038. //    none
  3039. //
  3040. //    Return
  3041. //        none
  3042. //
  3043. ////////////////////////////////////////////////////////////
  3044. void IMGEXP ImgDLLClearPNGText();
  3045.  
  3046. ////////////////////////////////////////////////////////////
  3047. //
  3048. //    UINT IMGEXP ImgDLLGetPNGTextCount();
  3049. //
  3050. //    Purpose :
  3051. //        Ask ImgDLL how many text fields were read when the last
  3052. //    PNG file was read. 
  3053. //
  3054. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  3055. //
  3056. //    Param            Type            Use
  3057. //    none
  3058. //
  3059. //    Return
  3060. //        UINT - number of fields read
  3061. //
  3062. ////////////////////////////////////////////////////////////
  3063. UINT IMGEXP ImgDLLGetPNGTextCount();
  3064.  
  3065. ////////////////////////////////////////////////////////////
  3066. //
  3067. //    BOOL IMGEXP ImgDLLAddPNGText(const char *key,
  3068. //                                const char *text,
  3069. //                                BOOL compress);
  3070. //
  3071. //    Purpose :
  3072. //        Add a text field to the ImgDLL global PNG text buffer.
  3073. //    PNG text fields consist of a mandatory 1-79 character key and 
  3074. //    an optional text buffer of any size. The text can be written 
  3075. //    compressed or uncompressed. It is not recommended that you compress text 
  3076. //    fields of length < 1000.
  3077. //
  3078. //    Keys should be plain ASCII, no control or non-printable chars.
  3079. //
  3080. //    You may add as many fields as you wish. 
  3081. //
  3082. //  The keywords that are given in the PNG Specification are:
  3083. //
  3084. //            Title            Short (one line) title or caption for image
  3085. //            Author           Name of image's creator
  3086. //            Description      Description of image (possibly long)
  3087. //            Copyright        Copyright notice
  3088. //            Creation Time    Time of original image creation
  3089. //            Software         Software used to create the image
  3090. //            Disclaimer       Legal disclaimer
  3091. //            Warning          Warning of nature of content
  3092. //            Source           Device used to create the image
  3093. //            Comment          Miscellaneous comment; conversion from other
  3094. //                             image format
  3095. //
  3096. //    NOTE : All fields will be cleared after the next ImgDLL PNG file write
  3097. //    action.
  3098. //
  3099. //    Please read the PNG Notes in the ImgDLLv3.RTF file.
  3100. //
  3101. //    Param            Type            Use
  3102. //    key                char *            key string 1-79 ASCII chars
  3103. //    title            char *            text string
  3104. //    compress        BOOL            compress text if TRUE
  3105. //
  3106. //    Return
  3107. //        TRUE on success
  3108. //
  3109. ////////////////////////////////////////////////////////////
  3110. BOOL IMGEXP ImgDLLAddPNGText(const char *key,
  3111.                                 const char *text,
  3112.                                 BOOL compress);
  3113.  
  3114.  
  3115. ////////////////////////////////////////////////////////////
  3116. //
  3117. //    HGLOBAL IMGEXP ImgDLLTIFFToRGB(const char * path,
  3118. //                                  UINT *pWidth,
  3119. //                                  UINT *pHeight);
  3120. //
  3121. //    Purpose :
  3122. //        read a 24-bit image from a non-LZW-compressed TIFF image
  3123. //
  3124. //
  3125. //    Param            Type            Use
  3126. //    path            const char *    path to open for reading
  3127. //    pWidth            UINT*            width, in pixels
  3128. //    pHeight            UINT*            height, in pixels
  3129. //
  3130. //    Return
  3131. //        HGLOBAL . 
  3132. //        Caller must use GlobalUnlock to get a ptr to this buffer!
  3133. //        Caller is responsible for calling GlobalFree on this buffer!
  3134. //
  3135. ////////////////////////////////////////////////////////////
  3136.  
  3137. HGLOBAL IMGEXP ImgDLLTIFFToRGB(const char * path,
  3138.                                   UINT *pWidth,
  3139.                                   UINT *pHeight);
  3140.  
  3141. ////////////////////////////////////////////////////////////
  3142. //    BOOL IMGEXP ImgDLLSaveRGB24ToTIFFRGB(LPCSTR lpFileName,
  3143. //                            BYTE *pRGB,
  3144. //                            UINT nWidth,
  3145. //                            UINT nHeight);
  3146. //
  3147. //    Purpose :
  3148. //        Save an RGB buffer to a non-LZW-compressed TIFF file . 
  3149. //        Buffer must be packed RGB.
  3150. //
  3151. //
  3152. //    Param                Type            Use
  3153. //    fileName            const char *    path to open for writing
  3154. //    pBuf                BYTE *            image buffer
  3155. //    uWidthPix            UINT            width, in pixels
  3156. //    uHeight                UINT            height, in pixels
  3157. //
  3158. //    modifies global error value, check with    ImgDLLGetLastError()
  3159. //
  3160. //    Return
  3161. //        TRUE on success
  3162. //
  3163. ////////////////////////////////////////////////////////////
  3164.  
  3165. BOOL IMGEXP ImgDLLSaveRGB24ToTIFFRGB(LPCSTR lpFileName,
  3166.                             BYTE *pRGB,
  3167.                             UINT nWidth,
  3168.                             UINT nHeight);
  3169.  
  3170. ////////////////////////////////////////////////////////////
  3171. //
  3172. //    BOOL IMGEXP ImgDLLSaveColormappedToTIFF(LPCSTR lpFileName,
  3173. //                            BYTE *pRGB,
  3174. //                            UINT nWidth,
  3175. //                            UINT nHeight,
  3176. //                            RGBQUAD *pPal);
  3177. //
  3178. //    Purpose :
  3179. //        Save an 8-bit colormapped image to a non-LZW-compressed TIFF file . 
  3180. //
  3181. //
  3182. //    Param                Type            Use
  3183. //    fileName            const char *    path to open for writing
  3184. //    pBuf                BYTE *            image buffer
  3185. //    uWidthPix            UINT            width, in pixels
  3186. //    uHeight                UINT            height, in pixels
  3187. //    pPal                RGBQUAD *        ptr to array of 256 RGBQUAD values -the image palette
  3188. //
  3189. //    modifies global error value, check with    ImgDLLGetLastError()
  3190. //
  3191. //    Return
  3192. //        TRUE on success
  3193. //
  3194. ////////////////////////////////////////////////////////////
  3195. BOOL IMGEXP ImgDLLSaveColormappedToTIFF(LPCSTR lpFileName,
  3196.                             BYTE *pRGB,
  3197.                             UINT nWidth,
  3198.                             UINT nHeight,
  3199.                             RGBQUAD *pPal);
  3200.  
  3201. ////////////////////////////////////////////////////////////
  3202. //
  3203. //    HGLOBAL IMGEXP ImgDLLReadRGBFromPCX(const char * fileName,
  3204. //                             UINT *width,
  3205. //                             UINT *height)
  3206. //
  3207. //
  3208. //    Purpose :
  3209. //        Read a PCX file to a buffer of RGB bytes.
  3210. //
  3211. //    Param                Type            Use
  3212. //    fileName            const char *    path to open for reading
  3213. //    uWidth                UINT*            width, in pixels
  3214. //    uHeight                UINT*            height, in pixels
  3215. //
  3216. //    modifies global error value, check with    ImgDLLGetLastError()
  3217. //
  3218. //    Return
  3219. //        HGLOBAL . 
  3220. //        Caller must use GlobalLock to get a ptr to this buffer!
  3221. //        Caller is responsible for calling GlobalFree on this buffer!
  3222. //
  3223. ////////////////////////////////////////////////////////////
  3224.  
  3225. HGLOBAL IMGEXP ImgDLLReadRGBFromPCX(const char* filename,
  3226.                                           UINT *width,
  3227.                                           UINT *height);
  3228.  
  3229.  
  3230. ////////////////////////////////////////////////////////////
  3231. //
  3232. //    BOOL IMGDLLEXP ImgLibSaveRGB24ToPCXRGB(LPCSTR lpFileName,
  3233. //                            BYTE *pRGB,
  3234. //                            UINT nWidth,
  3235. //                            UINT nHeight)
  3236. //
  3237. //
  3238. //    Purpose :
  3239. //        Write a 24-bit PCX file from a 24-bit RGB buffer
  3240. //
  3241. //    Param                Type            Use
  3242. //    fileName            const char *    path to open for writing
  3243. //    pRGB                BYTE *            ptr to the image
  3244. //    uWidth                UINT*            width, in pixels
  3245. //    uHeight                UINT*            height, in pixels
  3246. //
  3247. //    modifies global error value, check with    ImgDLLGetLastError()
  3248. //
  3249. //    Return
  3250. //        TRUE on success
  3251. //
  3252. ////////////////////////////////////////////////////////////
  3253.                          
  3254. BOOL IMGEXP ImgDLLSaveRGB24ToPCXRGB(LPCSTR lpFileName,
  3255.                             BYTE *pRGB,
  3256.                             UINT nWidth,
  3257.                             UINT nHeight);
  3258.  
  3259. ////////////////////////////////////////////////////////////
  3260. //
  3261. //    BOOL IMGLIBEXP ImgDLLSaveColormappedToPCX(LPCSTR lpFileName,
  3262. //                            BYTE *pRGB,
  3263. //                            UINT nWidth,
  3264. //                            UINT nHeight,
  3265. //                            RGBQUAD *pPal)
  3266. //
  3267. //    Purpose :
  3268. //        Write an 8-bit PCX file from a colormapped buffer
  3269. //
  3270. //    Param                Type            Use
  3271. //    fileName            const char *    path to open for writing
  3272. //    pRGB                BYTE *            ptr to the 8-bit image
  3273. //    uWidth                UINT*            width, in pixels
  3274. //    uHeight                UINT*            height, in pixels
  3275. //    pPal                RGBQUAD *        ptr to 256 RGBQUADs
  3276. //
  3277. //    modifies global error value, check with    ImgDLLGetLastError()
  3278. //
  3279. //    Return
  3280. //        TRUE on success
  3281. //
  3282. ////////////////////////////////////////////////////////////
  3283.  
  3284. BOOL IMGEXP ImgDLLSaveColormappedToPCX(LPCSTR lpFileName,
  3285.                             BYTE *pRGB,
  3286.                             UINT nWidth,
  3287.                             UINT nHeight,
  3288.                             RGBQUAD *pPal);
  3289.  
  3290.  
  3291. ////////////////////////////////////////////////////////////
  3292. //
  3293. //    HGLOBAL IMGEXP ImgDLLCreateDJIS(const char *fileName,
  3294. //                        UINT *width,
  3295. //                        UINT *height)
  3296. //
  3297. //    Purpose :
  3298. //        Create a JPEG Decompression structure for single-line
  3299. //    JPEG decompression.
  3300. //
  3301. //        This is to be used in conjunction with ImgDLLGetNextDJISLine
  3302. //    and ImgDLLDestroyDJIS.
  3303. //
  3304. //        You must call ImgDLLDestroyDJIS to free the memory associated
  3305. //    with this object!
  3306. //
  3307. //        See ImgDLLv3.rtf for example
  3308. //
  3309. //    Param                Type                Use
  3310. //    fileName            const char *    path to open for reading
  3311. //    width                UINT*                width, in pixels
  3312. //    height            UINT*                height, in pixels
  3313. //
  3314. //    modifies global error value, check with ImgDLLGetLastError()
  3315. //
  3316. //    Return
  3317. //        HGLOBAL to be passed to the other DJIS functions
  3318. //
  3319. ////////////////////////////////////////////////////////////
  3320.  
  3321. HGLOBAL IMGEXP ImgDLLCreateDJIS(const char *fileName,
  3322.                                                 UINT *width,
  3323.                                                 UINT *height);
  3324.  
  3325. ////////////////////////////////////////////////////////////
  3326. //
  3327. //    BOOL IMGEXP ImgDLLGetNextDJISLine(HGLOBAL hDJIS,
  3328. //                                        BYTE *pOutBuf)
  3329. //
  3330. //
  3331. //    Purpose :
  3332. //        Read the next scan line from a JPEG file previously
  3333. //    opened with ImgDLLCreateDJIS.
  3334. //
  3335. //        This is to be used in conjunction with ImgDLLCreateDJIS
  3336. //    and ImgDLLDestroyDJIS.
  3337. //
  3338. //        See ImgDLLv3.rtf for example
  3339. //
  3340. //    Param                Type                Use
  3341. //    hDJIS                HGLOBAL            returned from ImgDLLCreateDJIS
  3342. //    pOutBuf            BYTE *            start of buffer to receive RGB data
  3343. //
  3344. //    modifies global error value, check with ImgDLLGetLastError()
  3345. //
  3346. //    Return
  3347. //        TRUE on success. FALSE when end of file or error. 
  3348. //        check for IMGNOLINES from ImgDLLGetLastError()
  3349. //
  3350. ////////////////////////////////////////////////////////////
  3351.  
  3352. BOOL IMGEXP ImgDLLGetNextDJISLine(HGLOBAL hDJIS,
  3353.                                                 BYTE *pOutRow);
  3354.  
  3355. ////////////////////////////////////////////////////////////
  3356. //
  3357. //    BOOL IMGEXP ImgDLLDestroyDJIS(HGLOBAL hDJIS)
  3358. //
  3359. //    Purpose :
  3360. //        Release the memory associated with this object. This
  3361. //    object was previously allocated by ImgDLLCreateDJIS.
  3362. //
  3363. //        This is to be used in conjunction with ImgDLLCreateDJIS
  3364. //    and ImgDLLGetNextDJISLine.
  3365. //
  3366. //        See ImgDLLv3.rtf for example
  3367. //
  3368. //    Param                Type                Use
  3369. //    hDJIS                HGLOBAL            returned from ImgDLLCreateDJIS
  3370. //
  3371. //    modifies global error value, check with ImgDLLGetLastError()
  3372. //
  3373. //    Return
  3374. //        TRUE on success
  3375. //
  3376. ////////////////////////////////////////////////////////////
  3377.  
  3378. BOOL IMGEXP ImgDLLDestroyDJIS(HGLOBAL hDJIS);
  3379.  
  3380. ////////////////////////////////////////////////////////////
  3381. //
  3382. //    HGLOBAL IMGEXP ImgDLLCreateCJIS(const char *fileName,
  3383. //                                                UINT widthPix,
  3384. //                                                UINT height,
  3385. //                                                BOOL color, 
  3386. //                                                int quality)
  3387. //
  3388. //    Purpose :
  3389. //        Create a JPEG Compression structure for single-line
  3390. //    JPEG compression.
  3391. //
  3392. //        This is to be used in conjunction with ImgDLLWriteNextCJISLine
  3393. //    and ImgDLLDestroyCJIS.
  3394. //
  3395. //        You must call ImgDLLDestroyCJIS to free the memory associated
  3396. //    with this object!
  3397. //
  3398. //        See ImgDLLv3.rtf for example
  3399. //
  3400. //    Param                Type                Use
  3401. //    fileName            const char *    path to open for reading
  3402. //    widthPix            UINT                width of RGB image, in pixels
  3403. //    height            UINT*                height, in pixels
  3404. //    color                BOOL                TRUE = color, FALSE = grayscale
  3405. //    quality            int                0..100. 100 is high
  3406. //
  3407. //    modifies global error value, check with ImgDLLGetLastError()
  3408. //
  3409. //    Return
  3410. //        HGLOBAL to be passed to the other CJIS functions
  3411. //
  3412. ////////////////////////////////////////////////////////////
  3413.  
  3414. HGLOBAL IMGEXP ImgDLLCreateCJIS(const char *fileName,
  3415.                                                 UINT widthPix,
  3416.                                                 UINT height,
  3417.                                                 BOOL color, 
  3418.                                                 int quality);
  3419.  
  3420. ////////////////////////////////////////////////////////////
  3421. //
  3422. //    BOOL IMGEXP ImgDLLWriteNextCJISLine(HGLOBAL hCJIS,
  3423. //                                                    BYTE *pImageRow)
  3424. //
  3425. //    Purpose :
  3426. //        Write the next scan line to a JPEG file previously
  3427. //    opened with ImgDLLCreateCJIS.
  3428. //
  3429. //        This is to be used in conjunction with ImgDLLCreateCJIS
  3430. //    and ImgDLLDestroyCJIS.
  3431. //
  3432. //        See ImgDLLv3.rtf for example
  3433. //
  3434. //    Param                Type                Use
  3435. //    hCJIS                HGLOBAL            returned from ImgDLLCreateCJIS
  3436. //    pIamgeRow        BYTE *            pointer to the RGB row to write
  3437. //
  3438. //    modifies global error value, check with ImgDLLGetLastError()
  3439. //
  3440. //    Return
  3441. //        TRUE on success. FALSE when end of file or error. 
  3442. //        check for IMGNOLINES from ImgDLLGetLastError()
  3443. //
  3444. ////////////////////////////////////////////////////////////
  3445.  
  3446. BOOL IMGEXP ImgDLLWriteNextCJISLine(HGLOBAL hCJIS,
  3447.                                                     BYTE *pImageRow);
  3448.  
  3449. ////////////////////////////////////////////////////////////
  3450. //
  3451. //    BOOL IMGEXP ImgDLLDestroyCJIS(HGLOBAL hCJIS)
  3452. //
  3453. //    Purpose :
  3454. //        Release the memory associated with this object. This
  3455. //    object was previously allocated by ImgDLLCreateCJIS.
  3456. //
  3457. //        This is to be used in conjunction with ImgDLLCreateCJIS
  3458. //    and ImgDLLGetNextCJISLine.
  3459. //
  3460. //        See ImgDLLv3.rtf for example
  3461. //
  3462. //    Param                Type                Use
  3463. //    hDJIS                HGLOBAL            returned from ImgDLLCreateCJIS
  3464. //
  3465. //    modifies global error value, check with ImgDLLGetLastError()
  3466. //
  3467. //    Return
  3468. //        TRUE on success
  3469. //
  3470. ////////////////////////////////////////////////////////////
  3471.  
  3472. BOOL IMGEXP ImgDLLDestroyCJIS(HGLOBAL hCJIS);
  3473.  
  3474. ////////////////////////////////////////////////////////////
  3475. //
  3476. //    HGLOBAL IMGEXP ImgDLLCreateDBIS(const char *fileName,
  3477. //                        UINT *width,
  3478. //                        UINT *height)
  3479. //
  3480. //    Purpose :
  3481. //        Create a BMP Decompression structure for single-line
  3482. //    BMP decompression.
  3483. //
  3484. //        This is to be used in conjunction with ImgDLLGetNextDBISLine
  3485. //    and ImgDLLDestroyDBIS.
  3486. //
  3487. //        You must call ImgDLLDestroyDBIS to free the memory associated
  3488. //    with this object!
  3489. //
  3490. //        See ImgDLLv3.rtf for example
  3491. //
  3492. //    Param                Type                Use
  3493. //    fileName            const char *    path to open for reading
  3494. //    width                UINT*                width, in pixels
  3495. //    height            UINT*                height, in pixels
  3496. //
  3497. //    modifies global error value, check with ImgDLLGetLastError()
  3498. //
  3499. //    Return
  3500. //        HGLOBAL to be passed to the other DBIS functions
  3501. //
  3502. ////////////////////////////////////////////////////////////
  3503.     
  3504. HGLOBAL IMGEXP ImgDLLCreateDBIS(const char *fileName,
  3505.                         UINT *width,
  3506.                         UINT *height);
  3507.  
  3508. ////////////////////////////////////////////////////////////
  3509. //
  3510. //    BOOL IMGEXP ImgDLLGetNextDBISLine(HGLOBAL hDBIS,
  3511. //                                        BYTE *pOutBuf)
  3512. //
  3513. //
  3514. //    Purpose :
  3515. //        Read the next scan line from a BMP file previously
  3516. //    opened with ImgDLLCreateDBIS.
  3517. //
  3518. //        This is to be used in conjunction with ImgDLLCreateDBIS
  3519. //    and ImgDLLDestroyDBIS.
  3520. //
  3521. //        See ImgDLLv3.rtf for example
  3522. //
  3523. //    Param                Type                Use
  3524. //    hDBIS                HGLOBAL            returned from ImgDLLCreateDBIS
  3525. //    pOutBuf            BYTE *            start of buffer to receive RGB data
  3526. //
  3527. //    modifies global error value, check with ImgDLLGetLastError()
  3528. //
  3529. //    Return
  3530. //        TRUE on success. FALSE when end of file or error. 
  3531. //        check for IMGNOLINES from ImgDLLGetLastError()
  3532. //
  3533. ////////////////////////////////////////////////////////////
  3534.  
  3535. BOOL IMGEXP ImgDLLGetNextDBISLine(HGLOBAL hDBIS,
  3536.                                         BYTE *pOutBuf);
  3537.  
  3538. ////////////////////////////////////////////////////////////
  3539. //
  3540. //    BOOL IMGEXP ImgDLLDestroyDBIS(HGLOBAL hDBIS)
  3541. //
  3542. //    Purpose :
  3543. //        Release the memory associated with this object. This
  3544. //    object was previously allocated by ImgDLLCreateDBIS.
  3545. //
  3546. //        This is to be used in conjunction with ImgDLLCreateDBIS
  3547. //    and ImgDLLGetNextDBISLine.
  3548. //
  3549. //        See ImgDLLv3.rtf for example
  3550. //
  3551. //    Param                Type                Use
  3552. //    hDBIS                HGLOBAL            returned from ImgDLLCreateDBIS
  3553. //
  3554. //    modifies global error value, check with ImgDLLGetLastError()
  3555. //
  3556. //    Return
  3557. //        TRUE on success
  3558. //
  3559. ////////////////////////////////////////////////////////////
  3560.  
  3561. BOOL IMGEXP ImgDLLDestroyDBIS(HGLOBAL hDBIS);
  3562.  
  3563. ////////////////////////////////////////////////////////////
  3564. //
  3565. //    HGLOBAL IMGEXP ImgDLLCreateCBIS(const char *fileName,
  3566. //                                             BYTE * inBuf,    
  3567. //                                             UINT width,
  3568. //                                             UINT height,
  3569. //                                          int bitsPerPixel,
  3570. //                                             int colors,
  3571. //                                             RGBQUAD *colormap);    
  3572. //
  3573. //    Purpose :
  3574. //        Create a BMP Compression structure for single-line
  3575. //    BMP compression.
  3576. //
  3577. //        This is to be used in conjunction with ImgDLLWriteNextCBISLine
  3578. //    and ImgDLLDestroyCBIS.
  3579. //
  3580. //        You must call ImgDLLDestroyCBIS to free the memory associated
  3581. //    with this object!
  3582. //
  3583. //        See ImgDLLv3.rtf for example
  3584. //
  3585. //    Param                Type                Use
  3586. //    fileName            const char *    path to open for reading
  3587. //    widthPix            UINT                width of RGB image, in pixels
  3588. //    height            UINT                height, in pixels
  3589. //    bitsPerPixel    UINT                1,4,8,24 . if < 24, image must be in a
  3590. //                                            colormapped 8-bit buffer !!!!
  3591. //
  3592. //    colors            UINT                colors in the palette (may be 0 if 24-bit)
  3593. //    colormap            RGBQUAD*            pointer to an array of RGBQUADs. this must
  3594. //                                            have at least "colors" entries. may be NULL
  3595. //                                            for 24-bit.
  3596. //
  3597. //    modifies global error value, check with ImgDLLGetLastError()
  3598. //
  3599. //    Return
  3600. //        HGLOBAL to be passed to the other CBIS functions
  3601. //
  3602. ////////////////////////////////////////////////////////////
  3603.  
  3604. HGLOBAL IMGEXP ImgDLLCreateCBIS(const char *fileName,
  3605.                                              UINT width,
  3606.                                              UINT height,
  3607.                                               int bitsPerPixel,
  3608.                                              int colors,
  3609.                                              RGBQUAD *colormap);    
  3610.  
  3611. ////////////////////////////////////////////////////////////
  3612. //
  3613. //    BOOL IMGEXP ImgDLLWriteNextCBISLine(HGLOBAL hCBIS,
  3614. //                                                    BYTE *pImageRow)
  3615. //
  3616. //    Purpose :
  3617. //        Write the next scan line to a BMP file previously
  3618. //    opened with ImgDLLCreateCBIS.
  3619. //
  3620. //        This is to be used in conjunction with ImgDLLCreateCBIS
  3621. //    and ImgDLLDestroyCBIS.
  3622. //
  3623. //        See ImgDLLv3.rtf for example
  3624. //
  3625. //    Param                Type                Use
  3626. //    hCBIS                HGLOBAL            returned from ImgDLLCreateCBIS
  3627. //    pIamgeRow        BYTE *            pointer to the row to write.
  3628. //                                            this is RGB data for 24-bit files,
  3629. //                                            else 8-bit for all others.
  3630. //
  3631. //    modifies global error value, check with ImgDLLGetLastError()
  3632. //
  3633. //    Return
  3634. //        TRUE on success. FALSE when enf of file or error. 
  3635. //        check for IMGNOLINES from ImgDLLGetLastError()
  3636. //
  3637. ////////////////////////////////////////////////////////////
  3638.  
  3639. BOOL IMGEXP ImgDLLWriteNextCBISLine(HGLOBAL hCBIS,
  3640.                                                     BYTE *pImageRow);
  3641.  
  3642. ////////////////////////////////////////////////////////////
  3643. //
  3644. //    BOOL IMGEXP ImgDLLDestroyCBIS(HGLOBAL hCBIS)
  3645. //
  3646. //    Purpose :
  3647. //        Release the memory and close all files associated with this object. This
  3648. //    object was previously allocated by ImgDLLCreateCBIS.
  3649. //
  3650. //        This is to be used in conjunction with ImgDLLCreateCBIS
  3651. //    and ImgDLLGetNextCBISLine.
  3652. //
  3653. //        See ImgDLLv3.rtf for example
  3654. //
  3655. //    Param                Type                Use
  3656. //    hDJIS                HGLOBAL            returned from ImgDLLCreateCBIS
  3657. //
  3658. //    modifies global error value, check with ImgDLLGetLastError()
  3659. //
  3660. //    Return
  3661. //        TRUE on success
  3662. //
  3663. ////////////////////////////////////////////////////////////
  3664.  
  3665. BOOL IMGEXP ImgDLLDestroyCBIS(HGLOBAL hCBIS);
  3666.  
  3667. ////////////////////////////////////////////////////////////
  3668. //
  3669. //    BOOL IMGEXP ImgDLLAddJPGText(const char *key)
  3670. //
  3671. //    Purpose :
  3672. //        Add a text field to the ImgDLL global JPG text buffer. 
  3673. //
  3674. //        All strings added will be written to all JPG files written,
  3675. //    until the text buffers are cleared by a call to ImgDLLClearJPGOutputText.
  3676. //
  3677. //        Text should be plain ASCII, no control or non-printable chars.
  3678. //
  3679. //        You may add as many fields as you wish. 
  3680. //
  3681. //    Param            Type            Use
  3682. //    title            char *        text string
  3683. //
  3684. //    Return
  3685. //        TRUE on success
  3686. //
  3687. ////////////////////////////////////////////////////////////
  3688.  
  3689. BOOL IMGEXP ImgDLLAddJPGText(const char *text);
  3690.  
  3691. ////////////////////////////////////////////////////////////
  3692. //
  3693. //    void IMGEXP ImgDLLClearJPGOutputText();
  3694. //
  3695. //    Purpose :
  3696. //        clear the stored JPG output text fields. 
  3697. //
  3698. //    Param            Type            Use
  3699. //    none
  3700. //
  3701. //    Return
  3702. //        none
  3703. //
  3704. ////////////////////////////////////////////////////////////
  3705.  
  3706. void IMGEXP ImgDLLClearJPGOutputText();
  3707.  
  3708. ////////////////////////////////////////////////////////////
  3709. //
  3710. //    void IMGEXP ImgDLLClearJPGInputText();
  3711. //
  3712. //    Purpose :
  3713. //        clear the stored JPG output text fields. 
  3714. //
  3715. //    Param            Type            Use
  3716. //    none
  3717. //
  3718. //    Return
  3719. //        none
  3720. //
  3721. ////////////////////////////////////////////////////////////
  3722.  
  3723. void IMGEXP ImgDLLClearJPGInputText();
  3724.  
  3725. ////////////////////////////////////////////////////////////
  3726. //
  3727. //    UINT IMGEXP ImgDLLGetJPGInputTextCount();
  3728. //
  3729. //    Purpose :
  3730. //        Ask ImgDLL how many input text fields were read when the last
  3731. //    JPG file was read. 
  3732. //
  3733. //    Param            Type            Use
  3734. //    none
  3735. //
  3736. //    Return
  3737. //        UINT - number of fields read
  3738. //
  3739. ////////////////////////////////////////////////////////////
  3740. UINT IMGEXP ImgDLLGetJPGInputTextCount();
  3741.  
  3742. ////////////////////////////////////////////////////////////
  3743. //
  3744. //    HGLOBAL IMGEXP ImgDLLGetJPGText(UINT index);
  3745. //
  3746. //    Purpose :
  3747. //        return a buffer containing the text of one of the JPG text
  3748. //    fields.
  3749. //
  3750. //    a JPG file may contain any number text fields (JPEG_COM markers).
  3751. //    These strings can be any length. When ImgDLL reads a JPG file, 
  3752. //    it stores these strings in the ImgDLL JPG text buffer. These 
  3753. //    strings remain valid until the next JPG file is read or 
  3754. //    ImgDLLClearJPGText is called. 
  3755. //
  3756. //    Param            Type            Use
  3757. //    index            UINT            index of string you'd like to fetch
  3758. //
  3759. //    modifies global error value, check with    ImgDLLGetLastError()
  3760. //
  3761. //    Return
  3762. //        HGLOBAL to a zero-terminated string, else NULL on error
  3763. //
  3764. ////////////////////////////////////////////////////////////
  3765.  
  3766. HGLOBAL IMGEXP ImgDLLGetJPGText(UINT index);
  3767.  
  3768.  
  3769. #ifdef __cplusplus
  3770. }
  3771. #endif
  3772.  
  3773.  
  3774. #endif